Skip to content

feat(chat): follow agent workspace changes - #125

Merged
RestartFU merged 3 commits into
masterfrom
xd/https-github-com-restartfu-xd-issues-123-8d2a1281
Jul 28, 2026
Merged

feat(chat): follow agent workspace changes#125
RestartFU merged 3 commits into
masterfrom
xd/https-github-com-restartfu-xd-issues-123-8d2a1281

Conversation

@RestartFU

Copy link
Copy Markdown
Owner

Summary

  • let agents report active worktrees with a hidden <workspace> control block
  • retarget chat panes, diff tracking, HEAD watching, and remote branch context
  • accept only worktrees registered with the current repository

Tests

  • docker build --target test --progress plain . (21 suites pass)

Closes #123

Accept only worktrees registered with the current repository so workspace reports cannot expand a later turn's write sandbox.

Closes #123

Co-authored-by: Codex <codex@openai.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@RestartFU, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e3689d24-7e48-4e93-b6cf-72b7e49d9089

📥 Commits

Reviewing files that changed from the base of the PR and between 15869e4 and 306ba92.

📒 Files selected for processing (17)
  • src/chat/chat-view.c
  • src/meson.build
  • src/remote/server.c
  • src/remote/turn.c
  • src/remote/turn.h
  • src/storage/storage.c
  • src/storage/storage.h
  • src/util/ask-block.c
  • src/util/workspace-block.c
  • src/util/workspace-block.h
  • src/util/worktree.c
  • src/util/worktree.h
  • tests/meson.build
  • tests/test-ask.c
  • tests/test-storage.c
  • tests/test-workspace-block.c
  • tests/test-worktree.c
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xd/https-github-com-restartfu-xd-issues-123-8d2a1281

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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

close_segment (turn, FALSE);

P2 Badge Switch workspaces before capturing the next tool

When the agent reports a workspace immediately before its first file-changing tool there, close_segment() has not yet parsed the marker when this diff is captured, so the capture still uses the previous checkout. close_segment() then creates the new tracker after that tool has already modified the new checkout, making those changes its baseline and permanently omitting the first edit from the inline transcript. The daemon repeats the same ordering in src/remote/turn.c:on_tool_use; both paths should process the pending segment before capturing the tool.

ℹ️ 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".

@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: 33eb754730

ℹ️ 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/chat/chat-view.c
Comment on lines +2507 to +2508
if (reported != NULL && switch_turn_workspace (turn, reported))
text = without_workspace;

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 Switch workspaces before capturing a tool diff

When the agent reports <workspace> immediately before a file-changing tool, on_tool_use() captures and formats the tool using the old tracker and workdir before this call processes the report. For backends such as Claude, whose file_change event is deliberately deferred until after the edit completes, the old checkout contains no change; this switch then initializes the new tracker from the already-edited checkout, permanently omitting that edit from the inline diff. The daemon implementation has the same ordering, so both paths should close the segment and switch workspaces before capturing the tool diff.

Useful? React with 👍 / 👎.

Comment thread src/chat/chat-view.c
Comment on lines +2507 to +2508
if (reported != NULL && switch_turn_workspace (turn, reported))
text = without_workspace;

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 Hide rejected workspace control blocks

When a syntactically valid workspace report names a missing, stale, or unregistered checkout, switch_turn_workspace() returns false and this condition leaves text pointing at the original segment. The local live transcript therefore renders and stores the internal <workspace>…</workspace> markup, even though append_reply() strips the same block after a reload and the remote streaming path always hides it. Removing the control block should be independent of whether its path is accepted for retargeting.

Useful? React with 👍 / 👎.

@RestartFU
RestartFU merged commit 7994b22 into master Jul 28, 2026
4 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

1 participant