Repository navigation
Treat pi's manual compaction refusal as a skipped compaction, not a failed turn - #1807
Conversation
|
🚨 SLOP COP 🚨 · I am SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, and product behavior. |
| }); | ||
| } else if (compactionNoopDetail !== undefined) { | ||
| events.push({ | ||
| type: "provider/warning", |
There was a problem hiding this comment.
🚨 slopcop/review — Increment the host daemon protocol version
This code changes the daemon event stream. Existing remote daemons can keep protocol 132 and send the old failed result after deployment.
Increment HOST_DAEMON_PROTOCOL_VERSION and update its contract test. The mismatch will cause the required daemon update.
There was a problem hiding this comment.
Done in f07e5b4: bumped HOST_DAEMON_PROTOCOL_VERSION to 134 with a lineage note and updated the contract test.
| // A provider warning inside a compaction turn means the provider declined | ||
| // to compact (for example pi's "Nothing to compact"): the row settles as a | ||
| // skipped compaction instead of staying pending forever. | ||
| if (decoded.type === "provider/warning") { |
There was a problem hiding this comment.
🚨 slopcop/review — Match only the compaction-skip warning
This branch matches every turn-scoped provider warning, not only the Pi skip warning.
A separate warning can become “Context compaction skipped,” and the code then removes the original warning row.
I reproduced this result with a model-fallback warning. The timeline hid the warning and used its detail as compaction detail.
Match the exact skip signal or use a dedicated compaction outcome event.
There was a problem hiding this comment.
Done in f07e5b4: added a dedicated compaction-skipped warning category; the pi translator emits it, and the timeline settles the compaction row only for that category. Added a test where an unrelated warning during compaction keeps its own row and leaves the compaction pending.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
This pull request makes a small Pi /compact refusal harmless. It keeps the thread usable and shows a skipped-compaction row.
I found two high-impact defects.
- The change alters daemon events, but it does not increment the host daemon protocol version. Remote machines can keep the old behavior.
- The timeline treats every turn warning as a compaction skip. It can hide a real warning and corrupt the compaction row.
I left inline comments with exact locations and fixes.
The performance cost from the new string check is negligible. Repeated skips can cause quadratic scans, but the normal 1,500-event limit bounds this cost.
I found no security issue. The provider detail remains text, and the change adds no material denial-of-service path.
The codebase has no duplicate production refusal matcher. The architecture problem comes from using a general warning as a compaction lifecycle event.
Validation passed:
- All 697 tests passed in
@bb/agent-runtimeand@bb/thread-view. - Both package type checks passed.
- All GitHub checks passed.
- A live Pi test at the pull request SHA left the thread idle after
/compact. - The browser showed “Context compaction skipped” with the refusal detail. It did not show a failed compaction.
- An independent GPT-5.6 review gate confirmed both defects.
…sion Address SlopCop review on #1807: - Add the `compaction-skipped` provider warning category. The pi translator emits it for a refused manual compaction, and the thread view settles the pending compaction row only for that category. Other warnings inside a compaction turn keep their own row. - Bump HOST_DAEMON_PROTOCOL_VERSION to 134 so enrolled daemons update. - Regenerate the bundled plugin SDK types. Co-Authored-By: Claude <[email protected]>
ca1cc22 to
f07e5b4
Compare
…ailed turn
Pi reports "Nothing to compact (session too small)" and "Already
compacted" through the same compaction_end.errorMessage field as a real
failure. The pi translator turned every manual compaction error into
turn/completed status=failed, so the server moved the thread to error.
Classify those pre-flight refusals as a no-op: emit a provider/warning
("Context compaction skipped") and a normal turn/completed. In the
thread view, a provider warning inside a compaction turn settles the
pending compaction row as "Context compaction skipped" with the
provider detail, and the warning is not rendered a second time.
Fixes #1721
Co-Authored-By: Claude <[email protected]>
…sion Address SlopCop review on #1807: - Add the `compaction-skipped` provider warning category. The pi translator emits it for a refused manual compaction, and the thread view settles the pending compaction row only for that category. Other warnings inside a compaction turn keep their own row. - Bump HOST_DAEMON_PROTOCOL_VERSION to 134 so enrolled daemons update. - Regenerate the bundled plugin SDK types. Co-Authored-By: Claude <[email protected]>
f07e5b4 to
ced94d8
Compare
… skipped compaction Main commit 79a6058 landed this fix in the old pi event translator, which this branch deletes. The delta translator now recognizes pi's known refusal messages on a manual, non-aborted compaction_end and emits a turn-scoped provider.warning{compaction-skipped} plus a completed turn boundary instead of failing the turn. Domain, thread-view, and protocol-version pieces of the original commit merged cleanly during the rebase. Plan live-QA finding 1 is resolved. Co-Authored-By: Claude Fable 5 <[email protected]>
… skipped compaction Main commit 79a6058 landed this fix in the old pi event translator, which this branch deletes. The delta translator now recognizes pi's known refusal messages on a manual, non-aborted compaction_end and emits a turn-scoped provider.warning{compaction-skipped} plus a completed turn boundary instead of failing the turn. Domain, thread-view, and protocol-version pieces of the original commit merged cleanly during the rebase. Plan live-QA finding 1 is resolved. Co-Authored-By: Claude Fable 5 <[email protected]>
… skipped compaction Main commit 79a6058 landed this fix in the old pi event translator, which this branch deletes. The delta translator now recognizes pi's known refusal messages on a manual, non-aborted compaction_end and emits a turn-scoped provider.warning{compaction-skipped} plus a completed turn boundary instead of failing the turn. Domain, thread-view, and protocol-version pieces of the original commit merged cleanly during the rebase. Plan live-QA finding 1 is resolved. Co-Authored-By: Claude Fable 5 <[email protected]>
… skipped compaction Main commit 79a6058 landed this fix in the old pi event translator, which this branch deletes. The delta translator now recognizes pi's known refusal messages on a manual, non-aborted compaction_end and emits a turn-scoped provider.warning{compaction-skipped} plus a completed turn boundary instead of failing the turn. Domain, thread-view, and protocol-version pieces of the original commit merged cleanly during the rebase. Plan live-QA finding 1 is resolved. Co-Authored-By: Claude Fable 5 <[email protected]>
… skipped compaction Main commit 79a6058 landed this fix in the old pi event translator, which this branch deletes. The delta translator now recognizes pi's known refusal messages on a manual, non-aborted compaction_end and emits a turn-scoped provider.warning{compaction-skipped} plus a completed turn boundary instead of failing the turn. Domain, thread-view, and protocol-version pieces of the original commit merged cleanly during the rebase. Plan live-QA finding 1 is resolved. Co-Authored-By: Claude Fable 5 <[email protected]>
… skipped compaction Main commit 79a6058 landed this fix in the old pi event translator, which this branch deletes. The delta translator now recognizes pi's known refusal messages on a manual, non-aborted compaction_end and emits a turn-scoped provider.warning{compaction-skipped} plus a completed turn boundary instead of failing the turn. Domain, thread-view, and protocol-version pieces of the original commit merged cleanly during the rebase. Plan live-QA finding 1 is resolved. Co-Authored-By: Claude Fable 5 <[email protected]>
What was wrong
Pi has a
keepRecentTokensfloor (20k tokens by default). When a session has nothing before that floor,/compactrefuses before it calls the model withCompaction failed: Nothing to compact (session too small). Pi reports that refusal through the samecompaction_end.errorMessagefield as a real failure. The pi event translator (packages/agent-runtime/src/pi/event-translation.ts) turned every manualcompaction_enderror intoturn/completed status=failed. The server maps a failed root turn torun.failed, so the thread moved toerror, the composer showed "Retry by sending a follow-up message", andbb thread tell(steer mode) answeredHTTP 409: Thread is not active. Nothing was wrong with the session.Report: https://get-bb.github.io/reports/issues/1721.html
What changed
packages/agent-runtime/src/pi/event-translation.ts: a manualcompaction_endwith pi's pre-flight refusal messages (Nothing to compact (session too small),Already compacted) is a no-op. The translator emitsprovider/warning { summary: "Context compaction skipped", details: <pi message> }and a normalturn/completed status=completed. Real failures (for exampleSummarization failed: ...) still emitstatus=failed. Manual compaction still owns its maintenance turn.packages/thread-view/src/build-event-projection.ts,operation-projection.ts: aprovider/warninginside a compaction turn settles the pending compaction row asContext compaction skippedwith the warning detail. The row was otherwise pending forever, because nothread/compactedoritem/completedfollows a refusal. The warning is not rendered a second time as a standalone row.event-translation.test.tsgets the no-op case for both refusal messages and the pinned failure case now uses a real failure message.timeline-interruption.test.tsgets the projection case (with aproviderWarningfactory in the harness).Deviation from the report
The report suggested
provider/error{message:"Context compaction skipped"}as the cheapest way to close the compaction row. That renders a red "Provider error" row and an error-status compaction row, which is not informational. This PR usesprovider/warninginstead and settles the row with acompletedstatus. No wire contract changed, soHOST_DAEMON_PROTOCOL_VERSIONis unchanged.Update after SlopCop review
compaction-skippedprovider warning category (packages/domain). The pi translator emits it for a refused manual compaction, and the thread view settles the pending compaction row only for that category. An unrelated warning inside a compaction turn keeps its own row and leaves the compaction pending (new testkeeps a pending compaction and renders an unrelated warning in the same turn, fails before / passes after).HOST_DAEMON_PROTOCOL_VERSIONto 135 (134 was taken by Keep replayed Codex usage snapshots out of unknown turn ids #1804) (plus the contract test), because the daemon event stream and the warning category enum changed.packages/plugin-sdk/bundled-typesfor the new enum member.turbo typecheckfor domain, agent-runtime, thread-view, host-daemon-contract, plugin-sdk, server, app — 7 successful;turbo testfor domain (145), host-daemon-contract (52), thread-view (378), agent-runtime (320) — all pass.How I verified
status: "failed"with the pi error), and the new thread-view test failed (row stayedpending).pnpm exec turbo run typecheck --filter=@bb/agent-runtime --filter=@bb/thread-view— 2 successful.pnpm exec turbo run test --filter=@bb/agent-runtime --filter=@bb/thread-view— agent-runtime 320 passed, thread-view 377 passed.Fixes #1721