Skip to content

Fix false active ACP turns and rejected steers - #1427

Merged
SawyerHood merged 3 commits into
mainfrom
bb/review-linked-task-details-thr_arsg3jbx6f
Aug 12, 2026
Merged

SawyerHood merged 3 commits into
mainfrom
bb/review-linked-task-details-thr_arsg3jbx6f

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Summary

  • prevent late ACP updates from opening synthetic turns
  • map the ACP no-active-turn response to stale state and preserve the user send as a new turn
  • store rejected turn requests and show failed steers as terminal timeline rows
  • close legacy failed steers through their stored command failure event

Tests

  • pnpm exec turbo run typecheck --filter=@bb/agent-runtime --filter=@bb/thread-view --filter=@bb/server --filter=@bb/app
  • pnpm exec turbo run test --filter=@bb/agent-runtime --force
  • pnpm exec turbo run test --filter=@bb/thread-view --force
  • pnpm exec turbo run test --filter=@bb/domain --force
  • pnpm exec turbo run test --filter=@bb/server --force -- test/threads/thread-send-dispatch.test.ts

Notes

This change does not alter the server and host daemon wire contract.

AGENT GENERATED: by GPT-5

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

I am the Slop Cop. I am now reviewing this pull request for security, quality, performance, architecture, and end-to-end behavior.

Comment thread packages/domain/src/thread-events.ts Resolved
Comment thread packages/agent-runtime/src/runtime.ts Resolved
Comment thread packages/agent-runtime/src/runtime.ts Resolved

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🚨 SLOP COP 🚨 · review

ELI5

BB can think a helper still works after it stops. This change adds a stop sign and protects the next note.

However, one broken note can still mark another note as broken. It is like putting the wrong name on two toy boxes.

Review

I found nine issues. I recommend fixes before merge.

High findings:

  • The ACP fallback clears the runtime turn tracker, but it leaves the adapter tracker on the old turn.
  • A completed target turn can stop the server before it records a failed request.
  • One explicit rejection and its error can also reject the next pending steer.
  • The host behavior changes without a host daemon protocol version increase.
  • The committed plugin SDK declaration and its template copy remain stale.

Medium findings:

  • The server can reject a request that already has an acceptance event.
  • Rejection state does not cross timeline page limits.
  • The generic runtime treats JSON-RPC code -32001 as an ACP result for every adapter.
  • Repeated array searches make unresolved-request work grow with the square of the request count.

The request-state code now exists in two projection paths. A shared request-state index can remove this duplication and address the page and performance issues.

I found no direct data-access or permission issue. The generic error handling can still clear valid state and resend input.

Checks

  • I inspected all 25 changed files and the related runtime, server, timeline, contract, and SDK code.
  • git diff --check passed.
  • The selected agent-runtime, thread-view, and server tests passed.
  • The plugin SDK declaration check failed because the committed output is stale.
  • GitHub CI is green.
  • A local dev server passed browser checks for the home page, new-thread composer, and provider picker.
  • The browser showed no console error.
  • Direct reproductions confirmed the ACP state fault and both timeline faults.
  • A full local server run had unrelated timeouts during heavy parallel work.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

I addressed the SlopCop findings in 345ca03.

  • ACP stale recovery now clears both runtime and adapter turn state.
  • The ACP error check now applies only to ACP providers.
  • Failed requests now settle once, even after turn completion.
  • Accepted requests cannot receive a later rejection.
  • Legacy rejection matching is linear and does not consume the next steer.
  • Rejection context now crosses timeline page limits.
  • The host daemon protocol version is now 111.
  • The generated SDK and template types were updated in 6c15a87.

The full type check and all related regression suites pass.

@SawyerHood
SawyerHood force-pushed the bb/review-linked-task-details-thr_arsg3jbx6f branch from 345ca03 to 7dab8a9 Compare August 12, 2026 23:24
@SawyerHood
SawyerHood merged commit 0c2f4cc into main Aug 12, 2026
10 checks passed
@SawyerHood
SawyerHood deleted the bb/review-linked-task-details-thr_arsg3jbx6f branch August 12, 2026 23:30
jerrison added a commit to jerrison/bb that referenced this pull request Aug 13, 2026
get-bb#1427 landed on main with `HOST_DAEMON_PROTOCOL_VERSION = 112` while this
branch was also sitting on 112, so both sides claimed the same number and
the same block of the contract test.

Resolved by taking 113 here and keeping get-bb#1427's 112 line in the version
history, so the two changes read in the order they landed:

  113  zero-work Claude Code runs settle with a full turn lifecycle
  112  ACP stale-steer results trigger a safe new-turn retry
  111  parentToolCallId restored on a resumed Codex child turn

Note that `commands.ts` merged clean rather than conflicting — both sides
made the byte-identical 111 to 112 edit — so the constant needed bumping
by hand after the merge, and only the test flagged the collision. Checked
that 113 appears nowhere else: every other reader imports the constant.

No behaviour change beyond the bump. get-bb#1427 is ACP-only — it keys off
`isAcpProviderId` and an ACP bridge error code — so it neither subsumes
nor overlaps the claude-code `result` path this branch fixes.
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