Skip to content

Let agents point you at the diff, a file line, or the terminal - #1696

Merged
currentbits merged 2 commits into
mainfrom
coder/frontend-tools-agents-invoke-ui-actions--b7f956
Oct 19, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/frontend-tools-agents-invoke-ui-actions--b7f956

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Agents can now steer your attention instead of describing things in text. A new coder-threads tool, show_user, opens the Git pane on a changed file, opens the Files pane on a file with a line highlighted (this also covers artifacts like reports and screenshots), or opens the Terminal pane. Closes #293.

Changes

  • show_user MCP tool (target: diff | file | terminal, plus optional path, line and reason). The host normalizes the path to workspace-relative. It refuses a path that escapes the thread workspace, and refuses a missing file for file; diff may name a deleted file.
  • Transcript card. The tool call renders as a card showing what it points at, the agent's reason, and a Show button. If the card streams in live on the thread you're viewing, the pane opens once by itself. Revisiting a thread or scrolling history never re-opens anything.
  • Panes accept a target. The Git panel selects the file it's pointed at once that file appears in the loaded diff. The Files pane opens the file, then selects and scrolls to the line.
  • No new IPC or push channel: everything rides the existing transcript, so web mode works unchanged. The issue's "ask the user with structured multiple-choice options" item was already covered by ask_user.

Verification

  • npm run test:electron with the CODER_* variables inherited from the running app stripped and a node-only PATH: 4957 tests, 4954 pass, 0 fail, 0 cancelled.
  • npm run test:renderer: 3171/3171 pass.
  • npx tsc --noEmit and npx vite build are clean.
  • New tests:
    • Handler validation (relative and absolute paths, escape, missing file, deleted-file diff, wrong project).
    • Card behavior (live card opens once, history card waits for a click, a running call stays a plain tool card).
    • ThreadView seam test: clicking Show opens the Files pane with line 2 highlighted.
  • Not tested: a live agent calling the tool inside the running app.

Notes for reviewers

  • If the pointed-at file isn't in the current diff scope (e.g. Uncommitted vs Branch), the Git panel keeps the default selection and remembers the wanted path. A later refresh that includes the file will select it.
  • terminal opens the pane but deliberately doesn't move keyboard focus out of the composer.

claude-opus-5-5 via Claude Code

🤖 Generated with Claude Code

…293)

New coder-threads tool show_user (target diff | file | terminal). The host
validates the path against the thread workspace; the renderer reads the
result off the tool card, opens the pane when the card streams in live on
the open thread, and otherwise leaves a Show button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T09:54:53.120172Z 7f2fde9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 7f2fde92ef

ℹ️ 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 electron/orchServer.js
* renderer reads this result off the tool card and opens the pane.
*/
async function show_user(args) {
requireOwnThread(args);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bind show_user to the calling thread

When a bound MCP client supplies the ID of another thread in the same project, requireOwnThread accepts it because it checks only project membership. Path validation then uses the other thread's worktree, while the resulting card remains in the caller's transcript and opens the caller's panes, so it can reveal the wrong same-named file, fail unexpectedly, and probe whether paths exist in sibling worktrees. Validate args.threadId against boundThreadId, as the other self-only handlers do.

Useful? React with 👍 / 👎.

Comment on lines +576 to +577
// eslint-disable-next-line react-hooks/exhaustive-deps -- reveal is the trigger
}, [reveal]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reapply the reveal after the requested file loads

When the Files pane already displays a text file and show_user points to another text file, Preview keeps the old text while the new read is pending. This effect runs immediately against those old lines; if the requested line exceeds the old file's length it returns, and because the effect depends only on reveal, it never retries when the new text arrives. The requested line is therefore neither selected nor scrolled into view for this common navigation path.

Useful? React with 👍 / 👎.

Comment on lines 540 to 544
<TextPreview
path={path}
text={state.preview.text}
reveal={reveal}
onAddToPrompt={onAddToPrompt}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor line reveals for Markdown files

For a .md or .markdown target with a line number, the default branch renders MarkdownBody; the new reveal value is passed only to TextPreview in the alternate source branch. Consequently, pointing at a line in a Markdown report—one of the advertised artifact use cases—opens the document but never highlights or scrolls to the requested line unless the user manually switches to Source.

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit bae0a37 into main Oct 19, 2026
6 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.

Frontend tools: agents invoke UI actions (open diff, reveal file, focus terminal)

1 participant