Skip to content

test(cli): cover ACP follow's stale-attach guard - #154

Merged
dezren39 merged 1 commit into
mainfrom
sweep/125-acp-follow-stale-guard-test
Oct 20, 2026
Merged

dezren39 merged 1 commit into
mainfrom
sweep/125-acp-follow-stale-guard-test

Conversation

@dezren39

@dezren39 dezren39 commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Problem

#125: the stale-attach guard in follow (packages/cli/src/acp/turn.ts, added by PR #58) had no test — deleting it left all 115 ACP tests passing. Without it, an overlapping session/load whose MCP registration finishes after a newer load of the same session stops the newer attachment's follower, so later asks from that session reach the client only on the next prompt/load/resume.

Solution

One new test in packages/cli/test/acp/turn.test.ts: "a stale load finishing after a newer load does not stop the newer follower".

  • Starts load A with one MCP server and holds its PUT /api/experimental/mcp/tools via the wire fixture's fetch override (the fixture records the request before awaiting the override, so the test observes the held registration via server.requests).
  • Runs load B of the same session (no MCP servers) to completion — B attaches and its follower starts.
  • Releases A's registration and lets load A finish; A is now the stale attachment.
  • Sends a permissionAsked event and asserts the client still receives the reply from B's follower.

Test-only change; no production code touched.

Verification

  • Ablation: with the guard lines removed from turn.ts, the suite shows exactly 1 failure — this test (15 pass / 1 fail). With the guard, 16/16 in turn.test.ts.
  • New test passes 10/10 under --rerun-each 10.
  • Full ACP suite: 116/116 pass. packages/cli typecheck clean; prettier clean.

Closes #125


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Add a regression test for the guard in turn.follow (packages/cli/src/acp/turn.ts)
that stops a stale session/load from interrupting the newer attachment's
follower. The test holds load A's MCP registration via the wire fixture's
fetch override, lets load B attach and follow, then releases A and asserts
a later permission ask is still answered by B's follower.

Verified: fails with the guard removed (1 fail, the new test), passes with
it; 10/10 under --rerun-each 10; full ACP suite 116/116; cli typecheck clean.

Closes #125
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4049257f-63c3-43c1-99ab-202a95cd7476
📥 Commits

Reviewing files that changed from the base of the PR and between 0d28e35 and 1bcf830.

📒 Files selected for processing: 1
  • packages/cli/test/acp/turn.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 commented Oct 20, 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-20T02:52:11.716161Z 1bcf830 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.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

The following comment was made by an LLM, it may be inaccurate:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(cli): ACP follow's stale-attach guard is untested — removing it leaves all 115 ACP tests passing

1 participant