Skip to content

fix(context): unify "add to context" vocabulary + broaden composer picker + tree attach#214

Merged
haowei2000 merged 2 commits into
developfrom
fix/context-vocab-and-pickers
Jul 16, 2026
Merged

fix(context): unify "add to context" vocabulary + broaden composer picker + tree attach#214
haowei2000 merged 2 commits into
developfrom
fix/context-vocab-and-pickers

Conversation

@haowei2000

Copy link
Copy Markdown
Collaborator

Fixes the three recorded frontend context-UX issues.

#1 — Composer "Add context" was too narrow

Only offered Plan + Recent decisions, though the model supports more channel-scoped kinds. Broadened the quick-pick to Plan · Recent decisions · Sessions · Cost (the target-less channel reads), + a footer note that files / messages / a bot's workspace files attach from their own panels (they need a specific target, so they don't belong in a target-less menu). ✅ verified live on kind (popover items + footer).

#2a + #3 — "Attach / Add context / Attach lines" vocabulary mess

Same act (attach a resource to the next message's context_bundle) wore 3 head verbs across 5 surfaces. New single source of truth context/contextLabels.ts: one head verb "Add … to context", object explicit, scope "your next message". Applied to the composer menu, RemoteWorkspace attach, and Workbench file/board/passage.

  • File-upload "Attach file" left as-is — different concept; the split now disambiguates it.

#2b — RemoteWorkspace tree had no per-row attach

You had to open a file before you could attach it. Added a per-row hover "add to context" button on file rows (dirs excluded), reusing AttachContextButton + workspaceContextItem. Cheap: a workspace.read attach is a text-only reference (bot_id + path), so the tree row already has everything — no file read.

Labels/UX only, no behavior change. tsc (touched files) + vite build clean. RemoteWorkspace opened-file text (#2a) + tree hover (#2b) need an online bot's workspace to view live — build-clean + structurally verified.

🤖 Generated with Claude Code

…cker + tree attach

Addresses three recorded frontend issues about the context-attach UX.

#1 — Composer "Add context" only offered Plan + Recent decisions, though the
model supports more channel-scoped kinds. Broaden the quick-pick to Plan · Recent
decisions · Sessions · Cost (the target-less channel reads), and add a footer note
that files / messages / a bot's workspace files attach from their own panels
(they need a specific target).

#2a + #3 — The same act (attach a resource to the next message's context_bundle)
wore three head verbs across five surfaces ("Add context" / "Attach" / "Attach
this file|board|the selected lines"). New single source of truth
`context/contextLabels.ts`: one head verb "Add … to context", object explicit,
scope "your next message". Applied to the composer menu, RemoteWorkspace attach,
and Workbench file/board/passage. (File-UPLOAD "Attach file" left as-is — it's a
different concept, and the split now disambiguates it.)

#2b — RemoteWorkspace file tree had no attach affordance; you had to open a file
first. Add a per-row hover "add to context" button on file rows (dirs excluded),
reusing AttachContextButton + workspaceContextItem. Cheap because a workspace.read
attach is a text-only reference (bot_id + path) — no file read needed.

Labels/UX only; no behavior change. tsc (touched files) + vite build clean;
#1 verified live on kind (popover items + footer + unified button title).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

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

Copy link
Copy Markdown

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: 7cf41f7c8c

ℹ️ 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 frontend/src/features/chat/context/ContextPickBar.tsx
Comment thread frontend/src/features/chat/RemoteWorkspaceDialog.tsx
…/cost + preserve workspace root

Two review findings on the context-UX PR:

[P1] The composer picks reference channel.plan.read / sessions / usage, but the MCP
bridge exposed NO tool for them (also true for the pre-existing Plan pick) — so the
recipient couldn't resolve them (unknown tools reject). Add read-only MCP tools
`read_plan` / `read_sessions` / `read_cost` mapping to those verbs.

[P2] A workspace.read tree/opened-file reference recorded only the relative path;
when browsing a non-default allowed root the broker passed no root and the connector
fell back to its default cwd / first allowed root — resolving a different same-named
file or failing. Thread the browse root end-to-end:
  workspaceContextItem(root) → params.root  →  MCP read_workspace copies `root`  →
  broker_workspace_read reads it  →  read_workspace_file_as_bot → workspace_call(root).
Root is now part of the reference identity (same path under two roots ≠ same chip).

Builds + tests green (MCP, gateway, frontend vitest incl. new root case).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@haowei2000
haowei2000 merged commit 41c6a65 into develop Jul 16, 2026
10 checks passed
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