Skip to content

🤖 feat: Instructions tab in right sidebar#3262

Open
ammar-agent wants to merge 15 commits into
mainfrom
sidebar-3gth
Open

🤖 feat: Instructions tab in right sidebar#3262
ammar-agent wants to merge 15 commits into
mainfrom
sidebar-3gth

Conversation

@ammar-agent
Copy link
Copy Markdown
Collaborator

@ammar-agent ammar-agent commented May 10, 2026

Summary

Adds an Instructions tab to the right sidebar that lists every instruction file (AGENTS.md, CLAUDE.md, AGENTS.local.md, …) loaded into the workspace's system prompt, grouped by scope, with per-file approximate token counts and click-to-expand previews. The panel scales gracefully when there are many files: each row is a one-liner with a 3-line preview, and the full content is rendered only on demand. The tab ships in the default layout for new workspaces and is auto-injected into existing persisted layouts on first load so upgrading users see it immediately.

This PR also restructures internals on two axes:

  1. Instruction context is now a typed InstructionFile / InstructionSet / InstructionSources tree shared between buildSystemMessage and the IPC payload — the panel cannot drift from what the agent actually sees.
  2. Right-sidebar tab definitions now live in a single declarative registry. Adding a non-terminal tab is a one-line change instead of a multi-file edit ledger.

Background

Until now, the only signal that AGENTS.md/CLAUDE.md/AGENTS.local.md was actually being loaded was indirect (system-prompt token totals or behavioral changes). Users had no way to inspect which instruction files the agent was seeing for a given workspace, where they came from, or how much of the context budget they were consuming.

Internally, instruction context flowed through the codebase as bare strings, and adding a new sidebar tab required edits in 8+ places (tab-id list, TAB_CONFIGS record + getTabConfig literal chain, label switch, panel-id constants, panel render switch, default-layout list, command-palette picker, per-tab toggle CommandIds + handlers). Both made it easy for the panel and the prompt builder to drift, and discouraged adding tabs.

Implementation

Typed instruction context (single source of truth)

New Zod schemas in src/common/orpc/schemas/instructions.ts, with TS types z.infer'd in src/common/types/instructions.ts:

type InstructionScope     = "global" | "workspace" | "subProject" | "project"
type InstructionFile      { path, filename, isLocal, scope, projectName?, content, bytes, tokens? }
type InstructionSet       { scope, projectName?, directory, files[], combinedContent }
type InstructionSources   { global: InstructionSet | null, context: InstructionSet[] }
type WorkspaceInstructions{ workspaceId, model, sources, files[], totalTokens }

buildSystemMessage and the new workspace.getInstructions IPC route consume the same types — the panel can never drift from what the agent actually sees.

Right-sidebar tab registry (single source of truth)

src/browser/features/RightSidebar/Tabs/tabRegistry.tsx now declares every static tab in one object:

const TAB_REGISTRY_DEF = {
  costs:        { name: "Stats",        inDefaultLayout: true, defaultOrder: 10, Label, renderPanel,},
  review:       { name: "Review",       inDefaultLayout: true, defaultOrder: 20, Label, renderPanel,},
  instructions: { name: "Instructions", inDefaultLayout: true, defaultOrder: 30, Label, renderPanel,},
  desktop:      { name: "Desktop",       featureFlag: PORTABLE_DESKTOP, defaultOrder: 40,},
  browser:      { name: "Browser",       featureFlag: AGENT_BROWSER,    defaultOrder: 50,},
  output:       { name: "Output",                                       defaultOrder: 60,},
  debug:        { name: "Debug",                                        defaultOrder: 70,},
} satisfies Record<string, TabRegistration>;

export type BaseTabType = keyof typeof TAB_REGISTRY_DEF;

That single registration drives:

  • The BaseTabType union (derived from keyof typeof TAB_REGISTRY).
  • The default layout for new workspaces (getDefaultLayoutTabIds() filters by inDefaultLayout).
  • A new ensureDefaultLayoutTabs migration in parseRightSidebarLayoutState that auto-injects missing default tabs into existing persisted layouts (so users see Instructions after upgrade without manual setup).
  • Label & panel rendering in RightSidebar.tsx (one RegistryTabPanel component replaces 6 per-tab activeTab === "…" blocks).
  • The Add-Tool command-palette picker (getOrderedBaseTabIds() instead of a hardcoded list).
  • A generic Hide/Show <Name> toggle command per tab (buildToggleTabCommand) that replaces hand-rolled navToggleOutput / navToggleInstructions entries.

Terminal tabs intentionally remain outside the registry — they're multi-instance (terminal:<sessionId>), keep-alive, and need session-aware wiring that doesn't fit the static "one panel per id" shape.

Backend (instruction loader)

  • src/node/utils/main/instructionFiles.tsreadInstructionSet / readInstructionSetFromRuntime / gatherInstructionSets now return structured InstructionSet objects with per-file path, bytes, isLocal, scope, projectName. combinedContent is still produced (so prompt output is byte-identical) but each file is also addressable on its own.
  • src/node/services/systemMessage.ts — formerly-private readInstructionSources is now exported as loadInstructionSources returning InstructionSources. buildSystemMessage derives the strings it needs from the structured tree, leaving the prompt body unchanged.
  • src/node/services/instructionsService.ts (new) — composes loadInstructionSources + per-file tokenizerService.countTokens (LRU-cached, model-aware). Tokenizer failures degrade gracefully to tokens: null.
  • IPC: new workspace.getInstructions route; service wired into ORPCContext and ServiceContainer.

Frontend (panel)

src/browser/components/InstructionsTab/InstructionsTab.tsx — fetches via api.workspace.getInstructions and renders rows grouped by scope (Global / Workspace / Sub-project / Projects). Each row shows filename, scope badge, full path, byte size, ~N tokens badge, and a 3-line preview. Click to expand the full content inline. A refresh button re-reads from disk.

Validation

  • make static-check — clean (eslint, tsc, prettier, shellcheck, hadolint, doc-link checks all pass).
  • bun test src/browser/features/RightSidebar/ src/browser/utils/ — 1138 / 1138 pass.
  • bun test src/node/services/systemMessage.test.ts src/node/utils/main/instructionFiles.test.ts — 29 / 29 pass.
  • New test: parseRightSidebarLayoutState auto-adds missing default-layout tabs from the registry covers the upgrade migration.
  • Existing layout-migration tests were updated to assert presence/absence of specific tabs (rather than full-array equality) so they tolerate any future inDefaultLayout registry additions automatically.

Risks

This change touches:

  • System-prompt construction. Mitigated: buildSystemMessage test matrix (model-section extraction, multi-project layering, agent-prompt scoping, sub-project handling) still passes — the prompt output is byte-identical because the same combinedContent strings flow into it.
  • Persisted right-sidebar layouts. Mitigated: existing layout schema is unchanged; the migration only adds missing default tabs (it never reorders or removes user-arranged tabs). The Output / Instructions toggle commands now use a generic nav:toggle-tab:<id> id instead of the previous hand-rolled CommandIds; user keybindings configured against those legacy ids would need to be re-bound, but the default keybindings continue to work.

Worst case if the structured loader regresses: the Instructions tab shows stale or missing files. The system prompt itself is byte-identical to main because the same combinedContent strings flow into it.


Generated with mux • Model: anthropic:claude-opus-4-7 • Thinking: high • Cost: $17.30

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85d041ff33

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/utils/main/instructionFiles.ts Outdated
Adds an Instructions tab that shows every AGENTS.md / CLAUDE.md /
AGENTS.local.md loaded into the system prompt, grouped by scope, with
per-file token counts and click-to-expand previews.

Internal restructure: the instruction context is now a typed
InstructionFile/InstructionSet/InstructionSources tree shared between
buildSystemMessage and the IPC payload, so the panel cannot drift from
what the agent actually sees.
…ault layout

Adds the Instructions tab to the default right-sidebar layout (auto-injected
into existing persisted layouts via `ensureDefaultLayoutTabs` migration so
existing users see it after upgrade) and consolidates the per-tab bookkeeping
into a single declarative registry.

Adding a non-terminal tab is now a one-line entry in
`src/browser/features/RightSidebar/Tabs/tabRegistry.tsx`:

  instructions: {
    name: "Instructions",
    contentClassName: "overflow-hidden p-0",
    inDefaultLayout: true,
    defaultOrder: 30,
    Label: ({ workspaceId }) => <InstructionsTabLabel />,
    renderPanel: (ctx) => <InstructionsTab workspaceId={ctx.workspaceId} />,
  },

That single registration now drives:
  - The static tab-id union (`BaseTabType` derived from `keyof typeof TAB_REGISTRY`)
  - The default layout for new workspaces (via `inDefaultLayout` + `defaultOrder`)
  - The migration that auto-adds new default tabs to existing persisted layouts
  - The label and panel rendering inside `RightSidebar.tsx`
  - The Add-Tool command-palette picker
  - The generic `Hide/Show <Name>` toggle commands (one factory, no per-tab CommandIds)

Removed scattered ledger entries:
  - `RIGHT_SIDEBAR_TABS` array in `types/rightSidebar.ts` (now derived)
  - `TAB_CONFIGS` Record key union & `getTabConfig` literal chain
  - Per-tab `else if` label branches in `RightSidebar.tsx`
  - Per-tab `panelId` / `tabId` constants
  - Per-tab panel `activeTab === "..."` blocks
  - Hardcoded `["costs", "review"]` default-tab list
  - Bespoke `navToggleOutput` / `navToggleInstructions` CommandIds + handlers
  - Hardcoded Add-Tool option list
…s expand layout

Two fixes against the new Instructions tab + the long-standing prompt builder:

1. Sub-project workspaces missed the parent project's AGENTS.md.
   The prompt builder and the Instructions panel both received the workspace
   *execution* path (root + subProjectRelativePath) and treated it as the
   workspace root, joining the sub-project segment a second time. The result:
   the parent AGENTS.md was never read, and the sub-project AGENTS.md ended
   up labeled WORKSPACE.
   Fix: split out resolveWorkspaceRootPath in runtimeHelpers and have
   loadInstructionSources / readToolInstructions / instructionsService anchor
   at the workspace root explicitly.

2. Instructions FileRow expansion shifted the preview horizontally because
   the collapsed preview lived inside the indented column inside the
   <button>, while the expanded <pre> was a row-level sibling at px-3.
   Fix: move the preview/expanded body into a single sibling container with
   pl-[26px] and matching px-2 py-1 on both <pre>s, so the text starts at
   the same x/y position regardless of state. The body is now outside the
   <button>, so users can scroll/select long files without collapsing the
   row.

---

_Generated with `mux` • Model: `anthropic:claude-opus-4-7` • Thinking: `high` • Cost: `$31.21`_

<!-- mux-attribution: model=anthropic:claude-opus-4-7 thinking=high costs=31.21 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Rebased onto latest main and re-ran local validation:

  • make static-check
  • bun test src/node/services/systemMessage.test.ts src/node/utils/main/instructionFiles.test.ts src/node/runtime/runtimeHelpers.test.ts src/browser/utils/rightSidebarLayout.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d881d1c943

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/utils/commands/sources.ts Outdated
Comment thread src/node/utils/main/instructionFiles.ts Outdated
- Split lightweight right-sidebar tab metadata into tabConfig.ts so layout/types/commands can read default-layout policy without importing React panel renderers.
- Keep Instructions in the default-layout config and persist parsed layout migrations back to storage so existing workspaces retain the injected default tab across reloads.
- Add regression coverage that the default layout and RightSidebar UI include Instructions by default.
- Preserve AGENTS.local.md content when the tracked base instruction file strips to empty, addressing the Codex review thread.
- Avoid eager noVNC imports in the VS Code extension bundle by keeping non-UI helpers off the React tab registry.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/utils/main/instructionFiles.test.ts src/browser/utils/rightSidebarLayout.test.ts src/node/services/systemMessage.test.ts src/node/runtime/runtimeHelpers.test.ts ./tests/ui/layout/rightSidebar.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$49.18`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=49.18 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Updated after the rebase and feedback:

  • Instructions is enforced as a default-layout tab (new + existing layouts) and layout migrations are persisted.
  • Added tests for default Instructions visibility.
  • Fixed the AGENTS.local.md empty-base regression from the review thread.
  • Split lightweight tab metadata from React panel renderers so the VS Code extension no longer imports noVNC during its esbuild bundle.

Local validation passing:

  • make static-check
  • make vscode-ext
  • bun test src/node/utils/main/instructionFiles.test.ts src/browser/utils/rightSidebarLayout.test.ts src/node/services/systemMessage.test.ts src/node/runtime/runtimeHelpers.test.ts ./tests/ui/layout/rightSidebar.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00a958e353

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/utils/commands/sources.ts
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Updated per latest feedback:

  • Added a per-workspace Additional system context scratchpad at the top of Instructions.
  • Scratchpad auto-grows and writes immediately on typing (no Save button).
  • Scratchpad content is injected into additional system instructions on every send.
  • Forked workspaces copy the scratchpad session file.
  • Chat shows a collapsed decoration when scratchpad context exists; expanding it opens the same editor.
  • Removed Hide/Show commands for auto-restored default tabs (Stats/Review/Instructions); only optional tabs keep toggles.
  • The AGENTS.local.md empty-base regression remains fixed with coverage.

Local validation passing:

  • make static-check
  • make vscode-ext
  • bun test src/node/services/additionalSystemContext.test.ts src/node/utils/main/instructionFiles.test.ts src/browser/utils/rightSidebarLayout.test.ts src/node/services/systemMessage.test.ts src/node/runtime/runtimeHelpers.test.ts ./tests/ui/layout/rightSidebar.test.ts

- Add a per-workspace additional system context scratchpad stored in the workspace session directory.
- Inject scratchpad content into the existing additional-instructions system prompt path for every send, ahead of request-specific additional instructions.
- Show the auto-saving, auto-growing scratchpad at the top of the Instructions tab.
- Show a collapsed chat decoration when scratchpad content exists; expanding it opens the same editable scratchpad.
- Copy the scratchpad file when a workspace is forked so forks inherit the extra context.
- Remove Hide/Show commands for auto-restored default tabs, keeping those commands only for optional tabs.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/services/additionalSystemContext.test.ts src/node/utils/main/instructionFiles.test.ts src/browser/utils/rightSidebarLayout.test.ts src/node/services/systemMessage.test.ts src/node/runtime/runtimeHelpers.test.ts ./tests/ui/layout/rightSidebar.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Re-pushed after resolving all existing Codex threads so checks restart on the latest SHA. Local validation remains green:

  • make static-check
  • make vscode-ext
  • targeted tests listed above

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07501b1b59

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/InstructionsTab/AdditionalSystemContextScratchpad.tsx Outdated
Comment thread src/browser/utils/commands/sources.ts Outdated
Add the new workspace additional-system-context routes to the Storybook ORPC mock so stories that mount ChatPane/Instructions can fetch and edit the scratchpad.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/services/additionalSystemContext.test.ts src/node/utils/main/instructionFiles.test.ts src/browser/utils/rightSidebarLayout.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Pushed a Storybook mock fix for the new additional-system-context workspace routes. Local validation remains green:

  • make static-check
  • make vscode-ext
  • bun test src/node/services/additionalSystemContext.test.ts src/node/utils/main/instructionFiles.test.ts src/browser/utils/rightSidebarLayout.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9c68b88e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/InstructionsTab/AdditionalSystemContextScratchpad.tsx Outdated
- Mirror scratchpad edits into a renderer-side workspace snapshot immediately, so a message sent right after typing includes the latest visible context even if the disk write is still in flight.
- Merge that live snapshot into send options; backend merge logic de-duplicates it against the durable scratchpad file when both are present.
- Filter default-layout and feature-flagged tabs out of generic hide/add palette entries so disabled/default-restored tabs are not advertised as user-toggleable.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/services/additionalSystemContext.test.ts src/node/utils/main/instructionFiles.test.ts src/browser/utils/rightSidebarLayout.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the latest review comments:

  • Scratchpad edits now update a renderer-side live snapshot immediately; ChatInput merges that snapshot into send options so immediate sends include just-typed context even before the file write finishes. Backend merge de-duplicates against the durable scratchpad file.
  • Generic right-sidebar palette hide/add entries now exclude default-layout tabs and feature-flagged tabs.

Local validation passing:

  • make static-check
  • make vscode-ext
  • bun test src/node/services/additionalSystemContext.test.ts src/node/utils/main/instructionFiles.test.ts src/browser/utils/rightSidebarLayout.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b2b643c7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/common/utils/additionalSystemInstructions.ts
Guard scratchpad save completions with a per-workspace generation so stale in-flight writes from a previous workspace cannot clear or flush pending content for the current workspace after navigation.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/services/additionalSystemContext.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the stale scratchpad save race: save completions are now guarded by a per-workspace generation so old in-flight writes cannot flush or clear pending content for a newly selected workspace.

Local validation passing:

  • make static-check
  • make vscode-ext
  • bun test src/node/services/additionalSystemContext.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e9b898dea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/InstructionsTab/AdditionalSystemContextScratchpad.tsx Outdated
Thread the renderer's live additional-system-context snapshot through send options separately from request-specific additional instructions. The backend uses that live value when present instead of reading the durable file, so immediate sends cannot prepend stale on-disk scratchpad content while a save is still in flight.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/services/additionalSystemContext.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed stale durable scratchpad prepending by threading the renderer's live scratchpad snapshot through a separate send option. When present, backend uses the live value instead of reading the file, so a just-edited scratchpad cannot be combined with stale on-disk content.

Local validation passing:

  • make static-check
  • make vscode-ext
  • bun test src/node/services/additionalSystemContext.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f42cdaa26a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/features/ChatInput/index.tsx Outdated
Comment thread src/browser/components/InstructionsTab/AdditionalSystemContextScratchpad.tsx Outdated
Move scratchpad save coalescing into the shared renderer store so pending edits remain queued per workspace even if the editor unmounts or the user switches workspaces before an earlier save completes.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/services/additionalSystemContext.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Moved scratchpad save coalescing into the shared renderer store so pending edits remain queued per workspace even if the editor unmounts or the selected workspace changes before an earlier save completes.

Local validation passing:

  • make static-check
  • make vscode-ext
  • bun test src/node/services/additionalSystemContext.test.ts

Track per-workspace scratchpad hydration/version in the renderer store. Chat sends only include the live scratchpad override after the renderer has loaded or edited it, so startup sends still fall back to the durable file; concurrent loaders also skip stale responses if another editor has already updated the shared snapshot.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/services/additionalSystemContext.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the hydration/version issues:

  • Chat sends only include the live scratchpad override after the renderer has loaded or edited that workspace's scratchpad, so startup sends still fall back to the durable file.
  • The shared store tracks per-workspace versions; stale concurrent loader responses are ignored if another editor updated the snapshot while the request was in flight.

Local validation passing:

  • make static-check
  • make vscode-ext
  • bun test src/node/services/additionalSystemContext.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02ad1088a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/utils/additionalSystemContextStore.ts Outdated
When a newer scratchpad edit is queued while an older save is still in flight, ignore the older save response instead of writing it back into the shared live snapshot. The pending newer save will flush next and remains the value ChatInput sends.

Validation:
- make static-check
- make vscode-ext
- bun test src/node/services/additionalSystemContext.test.ts

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the stale save response issue: older save responses are ignored when a newer scratchpad edit is already pending, so the shared live snapshot remains the newest typed value until the pending save flushes.

Local validation passing:

  • make static-check
  • make vscode-ext
  • bun test src/node/services/additionalSystemContext.test.ts

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Account for the default Instructions tab being restored by the right-sidebar layout migration when terminal tabs are stripped during archive cleanup.

Validation:
- make static-check
- bun test src/browser/contexts/WorkspaceContext.test.tsx -t 'strips terminal tabs'

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Pushed a test-only update for the default Instructions tab migration expectation after archive cleanup. Local validation:

  • make static-check
  • bun test src/browser/contexts/WorkspaceContext.test.tsx -t 'strips terminal tabs'

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Update the split-layout E2E expectation for the default Instructions tab injected into the first tabset by the right-sidebar layout migration.

Validation:
- make static-check

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$62.84`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=62.84 -->
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Pushed an E2E expectation update for the default Instructions tab in split sidebar layouts. Local validation:

  • make static-check

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Copy Markdown
Collaborator Author

CI update: all GitHub Actions jobs and Codex are passing on the latest push. The only remaining pending checks are Chromatic UI Tests / UI Review, which require accepting 34 visual baseline changes in Chromatic for this PR. I don't have Chromatic project credentials/access from this environment to accept those baselines.

Replace the BookOpen icon on the Instructions tab strip with a count
badge to match the Stats and Review tabs. The badge picks up the
accent color when the per-workspace scratchpad has any user content,
giving a quick visual cue that this workspace is sending additional
system context to the agent.

A small workspaceInstructionsStore caches the file count per workspace
so the label can render immediately once data is available, and
triggers a one-shot getInstructions fetch on first mount when the
panel itself isn't rendered yet (e.g. another tab is active in the
same tabset).

---

_Generated with \`mux\` • Model: \`anthropic:claude-opus-4-7\` • Thinking: \`high\` • Cost: \`$237.75\`_

<!-- mux-attribution: model=anthropic:claude-opus-4-7 thinking=high costs=237.75 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant