Skip to content

fix(acp): compact opencode, and stop telling four backends they self-manage - #11942

Merged
bolichen97 merged 1 commit into
mainfrom
fix/compaction-audit-other-backends
Sep 20, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/compaction-audit-other-backends

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Kiro Crew only ran /compact for two backends: kiro-cli and Claude. Every other
one got the same answer, and the same sentence:

ℹ️ The <name> backend manages compaction automatically — it summarizes the
conversation on its own as context fills, so manual /compact isn't needed
(and isn't supported) here.

That sentence is a claim about five harnesses. I drove each one. It is true about
one of them.

The skip is not only about the typed command. _compaction_gate_decision reads
the same capability for the AUTOMATIC compaction, so a session on any of those
backends crossed session.autocompact_pct and Crew did nothing at all — no
compaction, no reset, no retry, and no line telling anyone.

Why it matters

Two ways this hurts a user.

A user on opencode, pi or goose typed /compact, got told their backend does it
for them, and it does not do it unasked. So their context filled up and nobody
compacted it. All three of those harnesses had a working /compact the whole
time.

A user on deepseek has it worse, because nothing Crew can see bounds their
context. deepseek's own window in my capture was 8192 tokens and the session sat
at 7695 of it, with no compaction command advertised, no compaction status on the
wire, and session/load answering "Method not found". Whether its harness
summarizes for itself at the wall I did not drive, and I claim it in neither
direction; what the capture settles is that no compaction path on that surface
answers a threshold Crew has already crossed. Crew read that number, decided the
harness had it covered, and let it grow.

What changed (motivation → approach → change)

I drove every backend outside ACP_BACKENDS_COMPACT and asked four questions of
each: does /compact do anything, does it finish inside the prompt turn, does the
harness compact on its own and say so, and what does Crew do at the threshold.

backend /compact works? when it finishes own auto-compact Crew before Crew after
kas no — yes, and reports it skip skip (right)
opencode yes, captured live in the turn not seen skip compacts
deepseek no — nothing on the wire skip restarts session
pi yes in source, no capture in the turn (source) yes, prose only skip, claiming it self-manages skip, and says so at WARNING
goose yes in source, no capture in the turn (source) yes, not reported skip, claiming it self-manages skip, and says so at WARNING
codex — — unknown skip, claiming it self-manages skip, and says so at WARNING

opencode joins both compaction sets. It serves /compact and finishes it
inside the prompt turn, so the turn ending is the done signal. It is also the only
harness here with a driven capture, which is the bar: source says what the code
would do, a capture says what the harness did. pi and goose look identical in
source and have none, so they wait in #11973.

kas keeps its skip, and now has a set that says why. New
ACP_BACKENDS_HARNESS_MANAGED_COMPACTION. Its one member summarizes unasked and
resets Crew's meter, so skipping costs nothing. Before, that was an absence, and an
absence records no decision.

The done signal for an inline harness lives on the wait. Membership alone
would have made things worse: the caller sends the prompt, sees no status, falls
into wait_for_compaction — which an inline harness never answers — burns 300s
holding the turn semaphore, then recycles a session that had just compacted. So
wait_for_compaction() answers completed from the capability, on AcpProvider
and AcpSessionHandle.

That method is the choice, not a convenience: it is the one place BOTH routes
arrive. Seventeen call sites pair provider.compact() with it; the autocompact
pairs stream_command("/compact") with it. A captured status still wins, and a
CANCELLED turn withholds the answer — it compacted nothing, and a false
completed resets the meter and arms the cooldown.

deepseek gets recycled instead of skipped. Third set,
ACP_BACKENDS_CONTEXT_RECYCLE. Its threshold reaches _recycle_unmanaged, where a
failed compaction already lands — on the reason rather than after the timeout that
proves it. The arm falls THROUGH the gate rung, so unconfirmed, in_progress and
cooldown still run first.

The destructive arm is granted by membership, never by exclusion. A harness in
none of the three sets declines: ending a conversation is not something a harness
earns by never having been classified. The gate logs a WARNING naming the missing
membership, told apart from the settled case by a new compaction_self_managed.

And every arm says what it does. Three sentences — self-managed, recycled, and
one that promises NOTHING. codex, pi and goose are that third case; all three used
to be told their backend self-manages, on no evidence. The wording stays per surface
and the CHOICE does not: one compact_refusal_arm() decides and five surfaces map
it. Two — the dashboard and iMessage — held one sentence covering all three cases.

Where each part lives

file what it carries
src/kiro_crew/agent_sdk/backends.py the three memberships, each with its evidence
src/kiro_crew/agent_sdk/backend_cards.py the new set classified as off-card, with the reason
src/kiro_crew/acp_backends.py, src/kiro_crew/acp/types.py the new set re-exported
src/kiro_crew/providers/base.py compaction_unmanaged_backend on the ABC, default None
src/kiro_crew/providers/acp.py, src/kiro_crew/acp/session_provider.py both provider shapes answer it from membership
src/kiro_crew/session_compaction.py the split gate rung, _recycle_unmanaged, the WARNING for an unclassified backend
src/kiro_crew/providers/acp.py, src/kiro_crew/acp/session_handle.py wait_for_compaction() answers inline members from the capability
src/kiro_crew/session.py one delegation line for the new recycle
src/kiro_crew/messaging/commands.py the three-arm reply, the shared Chinese reply, the membership predicate
src/kiro_crew/whatsapp/commands.py, src/kiro_crew/whatsapp/transport_dispatch.py WhatsApp's own three, mapped from the shared arm
src/kiro_crew/imessage/transport_dispatch.py, src/kiro_crew/dashboard/chat_runner.py two surfaces that still held the old single sentence
src/kiro_crew/feishu/transport_dispatch.py, src/kiro_crew/wecom/transport_dispatch.py, src/kiro_crew/weixin/transport_dispatch.py the three Chinese surfaces, now calling the shared reply
docs/system-specs/modules/session.md, docs/system-specs/modules/harness-onboarding.md the specs brought onto the new memberships

Evidence, per harness

harness class what settles it
opencode 1.18.30 live capture Advertises no compaction command at all — the old exclusion read that silence as the answer. It serves /compact out of its PROMPT handler. Over four turns usage_update.used climbed 14863 → 15727 → 16614 → 17478. /compact returned stopReason: end_turn with no status frame. The next ordinary turn read 14577, under the pre-compact peak, and the model answered from a summary of the dropped turns.
pi-acp 0.0.33 adapter source prompt() intercepts /compact before any model turn, awaits session.proc.compact(), raises if pi reports failure, emits one agent_message_chunk saying "Compaction completed.", returns { stopReason: "end_turn" }. Nothing follows. Its advertised compact + autocompact commands are live in this repo's own corpus.
goose 1.50.1 harness source, at the release goose already pins as its VERIFIED RANGE compact is a published built-in. ACP on_prompt → Agent::reply → execute_command dispatches it before a model turn, replaces the stored conversation, answers "Compaction complete". goose's own command_starts_turn("/compact") is false and its suite pins that.
kas live corpus summarization_started / summarization_completed in test/fixtures/acp_frames/kas/steering.jsonl, mapped by acp.kas_wire, calling reset_after_compaction().
deepseek 0.0.1 live corpus No available_commands_update at all; session/load is already Method not found; no compaction status in its session/update vocabulary. It does report a real meter: used 7554 → 7695 of size 8192 in one captured turn.

pi and goose could not be driven live on this host — pi answers Authentication required and goose Failed to resolve provider: GOOSE_PROVIDER. Their source is
quoted above because it is worth keeping, but source is not the bar this set holds
its members to, so they are deferred to #11973 rather than admitted on it.

Backwards compatibility

Compatible. kiro-cli and Claude take exactly the paths they took. kas keeps its
decline, its log line and its reply text word for word. The new ABC property
defaults to None, so a provider that never declares it reads as self-managing,
which changes nothing.

One behaviour change a user can see: a deepseek session at the autocompact
threshold is now restarted instead of left alone. It loses what the agent
remembered. The alternative was letting the context run into the harness's own
window, which loses the same thing and breaks every turn after it. The reply text
says which one happens.

The fail direction for a harness added later is deliberate and recorded on
ACP_BACKENDS_CONTEXT_RECYCLE: a backend joining none of the three sets declines
and is logged at WARNING, and is told the third sentence, which claims nothing. It
is not recycled. Granting the one session-ending arm by exclusion would be the
same defect as the false sentence this PR removes, only louder.

Tests

test/test_compaction_other_backends.py — 26 tests. Run against the unfixed base,
20 fail, each naming the missing set, the missing property or the wrong
behaviour. The 6 that pass in both states are the regression guards: kiro-cli
keeps its async wait, kas stays untouched, below_threshold still wins, and the
inline set stays a strict subset.

The gate tests drive a real SessionManager and assert the things a decline and a
recycle differ on: whether the prompt was sent, whether the status was awaited,
whether the entry was popped, whether the provider was shut down.

Updated: test_manual_compact_gate, test_auto_compact_gate,
test_acp_capability_sets_leaf, test_acp_goose_backend — each membership pin
moved deliberately rather than loosened.

test/test_codex_compaction.py — three tests from #11944, changed by the rebase
rather than by this PR's own design. Its exact-membership pin names opencode too;
its two in-place-arm tests read the seam wait_for_compaction instead of
_compact_in_place, which is where the arm this PR keeps lives. Everything #11944
pinned about codex — the frame translation, the marked pair, the dangling-started
settle, both transports — is untouched and green.

Local, post-rebase: 580 tests green across the affected suites
(test_codex_compaction, test_compaction_other_backends,
test_manual_compact_gate, test_auto_compact_gate,
test_acp_capability_sets_leaf, test_agent_sdk_capabilities,
test_acp_goose_backend, test_session, test_channel_compaction_notice,
test_harness_parity, the five messaging-surface dispatch suites and
test/metrics/test_business_counters). black, isort, flake8, comment-history,
harness-parity, agent-sdk-boundary, feature-map and docs-lint all clean. The
whole-tree suite is left to CI on purpose — the host is under memory pressure.

Manual verification

The opencode numbers above are a real session, driven over stdio against the
installed binary. The probe drivers are not in this diff; they are throwaway
scripts, and what they produced is quoted above and in the code comments.

Screenshots / video

Not applicable — no UI change. The only user-visible strings are chat replies,
quoted in full above.

Related Issues

no linked issue: found by auditing the compaction memberships directly rather than
from a filed report, so there is no ticket to close.

Stacks on #11944 (fix/codex-compaction), which has merged. It added codex to
these same two sets, so this branch is rebased on it and both memberships stand:
ACP_BACKENDS_COMPACT is {kiro, claude, codex, opencode} and
ACP_BACKENDS_INLINE_COMPACTION is {claude, codex, opencode}. codex's membership
stays #11944's decision and its evidence; this PR carries opencode's.

One of its lines is replaced rather than kept. #11944 also answered the inline case
inside _compact_in_place, by skipping the status wait for a member of
ACP_BACKENDS_INLINE_COMPACTION. This PR answers the same case on
wait_for_compaction instead, and that is the one kept, because the manual entry
points reach a compaction through provider.compact() and never through
_compact_in_place — an arm at that one call site leaves the other seventeen sites
stranding. The guarantee #11944 wanted there is unchanged: the wait returns at once
for an inline member instead of spending COMPACT_WAIT_TIMEOUT_SECS while holding
the turn semaphore. What changes is the outcome when an inline harness ends its
/compact turn having compacted nothing: #11944 recycled the session immediately,
and now the coordinator's own post-compaction meter reading catches it one rung
later (cooldown, then a reset when the context is still critical). Two of #11944's
tests pinned the old location and are retargeted to the seam; one pinned the exact
membership of the two sets and now names four harnesses.

Tracked follow-ups: #11973 — capture pi and goose driving /compact, then add
them to both sets. They look inline in source and this PR does not claim them,
because the set holds its members to a driven capture and neither could be driven
here. #11949 — The soft-threshold nudge is suppressed for every
non-member across the channel surfaces. That is right for kas — its /compact
advice genuinely cannot work — but it means a deepseek user gets no warning before
the restart. Warning them needs a third nudge string per surface, because the
existing nudge tells them to run /compact.

Pattern harvest

Rule candidate: review-prompt
Pattern: a capability withheld by absence rather than by a recorded decision

An absence is not a decision. Four harnesses sat outside ACP_BACKENDS_COMPACT
for four different reasons — one evidenced, two admitted guesses, one never
written down — and the code could not tell them apart, so all four got the same
behaviour and the same sentence. The fix is a second named set, so the reason a
backend is skipped becomes a thing a test can check.

The other one: a command list is not a capability list. opencode advertises no
compaction command and serves /compact anyway. Absence of a flag is evidence
only when the flag could have been there.

@iamwhatever
iamwhatever requested review from a team and buluoray September 19, 2026 05:08
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 19, 2026
@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 6f154dc861e6fb18b0b217c9a9a28dcbca5a4606 and found no blocking issues.

This comment is updated in place on each push.

Review details

FINDING -- src/kiro_crew/providers/acp.py:2020 -- "The set has exactly those two members" contradicts the three-member capability set, which also includes codex -> Fix: say those are the two members that emit no status. (origin: validation)
[GPT-REVIEWED] 6f154dc

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 6f154dc861e6fb18b0b217c9a9a28dcbca5a4606: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of 6f154dc861e6fb18b0b217c9a9a28dcbca5a4606 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

Deepseek's session-destroying recycle ships before its warning: users lose conversation state at threshold with no advance nudge (#11949 deferred).

Watch

The recycle arm for ACP_BACKENDS_CONTEXT_RECYCLE discards live conversation state at session.autocompact_pct, while the soft-threshold nudge stays suppressed for every ACP_BACKENDS_COMPACT non-member — the PR itself records "a deepseek user gets no warning before the restart." The first notice a user gets that their history is gone is the post-restart reply, and that gap is live from merge until #11949 lands.
Clears when: #11949 ships a recycle-specific pre-threshold nudge, or the nudge suppression exempts ACP_BACKENDS_CONTEXT_RECYCLE members in this PR.

[DESIGN-REVIEWED] 6f154dc

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 19, 2026
@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of 6f154dc861e6fb18b0b217c9a9a28dcbca5a4606 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The deepseek recycle arm auto-destroys sessions on a premise the author explicitly declines to claim — "I did not drive" the harness's own wall behavior.

Not justified as shipped

  • Item 2 — premise risk: the one destructive arm rests on "Whether its harness summarizes for itself at the wall I did not drive, and I claim it in neither direction"; if deepseek self-manages at the wall (as KAS does), recycling at 70% destroys conversations that would have shrunk on their own. The unclassified treatment pi/goose get (honest decline + WARNING) already removes the reported harms — the false claim and the silence.
    Subtraction: defer ACP_BACKENDS_CONTEXT_RECYCLE / _recycle_unmanaged until the wall is driven; deepseek joins pi/goose as unclassified meanwhile.
    Clears when: a capture drives deepseek across its 8192-token window, or a linked issue records the wall question as accepted-and-deferred.
  • Item 3 — framing: "codex, pi and goose are that third case; all three used to be told their backend self-manages" is contradicted by the diff's own base line (ACP_BACKENDS_COMPACT = frozenset({...ACP_BACKEND_CODEX})) — codex compacted on base and never reaches any refusal arm; the new test_every_surface_gives_the_same_three_way_answer docstring repeats it ("codex, which is in none of the three compaction sets").
    Subtraction: delete the false codex sentence from that docstring.
    Clears when: the docstring no longer claims codex reaches the refusal.

What this change ships

Inventory (10 items) — 8 justified

Intent: stop lying to users on five backends about who compacts their context, and compact where it actually works — a FIX.

  1. opencode /compact now works, manually and at the auto threshold — justified
  2. deepseek sessions are auto-restarted at the threshold instead of silently left to grow — premise risk: the harness's own wall behavior is unverified by the author's own statement
  3. pi/goose/unknown backends get a refusal that promises nothing, replacing the false "self-manages" claim — justified (but see framing note on codex above)
  4. KAS keeps its decline, now recorded as a positive membership with evidence — justified
  5. Manual /compact on inline backends returns at the turn boundary instead of hanging 300s then recycling — justified
  6. Dashboard and channel notices distinguish compacted / restarted / restarted-uncompactable — justified
  7. Five surfaces' refusal copies replaced by one shared three-arm helper (per-surface strings deleted) — justified
  8. An unclassified backend at threshold logs a WARNING naming the missing membership — justified
  9. Committed live opencode capture as the membership's evidence — justified
  10. Two new ABC capability answers with counted consumers (gate rungs in session_compaction) — justified

[FIRST-PRINCIPLES-REVIEWED] 6f154dc

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 19, 2026
@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 6f154dc861e6fb18b0b217c9a9a28dcbca5a4606 — this comment is updated in place on each push.

Review details

The discovery pass found no candidates. I independently traced the load-bearing paths — the three-arm gate (_compaction_gate_decision), the fall-through to _recycle_unmanaged, the uncompactable_recycles marker set in _recycle_held and consumed in _fire_compact_callback while _recycling[key] is still live, the inline short-circuit on both AcpProvider and AcpSessionHandle (fail-closed, positioned after the cached-status check), and the outcome keyword threaded through the single production callback (DashboardState._on_compacted, the only non-test registration). Each resolved to correct, defended behavior. I could not ground any new defect to the 80+ bar.

No findings.

[OPUS-REVIEWED] 6f154dc

Verdict parsed from the review's SHA-scoped output markers for commit 6f154dc861e6fb18b0b217c9a9a28dcbca5a4606.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6f154dc861e6fb18b0b217c9a9a28dcbca5a4606: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the fix/compaction-audit-other-backends branch from 8ec1faa to dbb4807 Compare September 19, 2026 05:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=cfcec2aa057b (Blocker: inline completion patched at one call site)

Legitimate, and the count is right. grep -rn wait_for_compaction src/kiro_crew
shows seventeen sites doing await provider.compact() then
await provider.wait_for_compaction() — discord, feishu, imessage, slack, teams,
telegram, webex, wecom, weixin, whatsapp, task_executor, plus the session layer.
Every one was unreachable for these three harnesses while the gate refused them,
and all seventeen became reachable in the same commit that granted membership.
None of them can see which harness it is talking to, so a completion taught to
one of them is a strand left in the other sixteen.

Fixed at the seam, as the clearing condition asks. AcpProvider.compact() now
records {"type": "completed", "summary": ""} after the turn drains when the
backend is in ACP_BACKENDS_INLINE_COMPACTION and no status frame arrived, and
AcpSessionHandle.compact() carries the same arm for the shared-runtime
sessions. wait_for_compaction() already consumes that cached result first, so
all seventeen callers return at once with no change of their own.

Second half of the clearing condition: the call-site special case in
_compact_in_place is deleted, and a test asserts compacts_inline no longer
appears in its source so it cannot come back. No summary is invented — an
inline harness reports none, and a made-up one would reach the user as the
backend's own words.

Pinned by TestTheInlineCompletionLivesOnTheSeam in
test/test_compaction_other_backends.py: the inline seam never enters the
client's queue wait, kiro-cli still falls through to its async status, both
seams carry the arm, and the coordinator carries no branch. Head dbb4807.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=3b442073bbbf (Item 9: symptom-level, cause is at the provider seam)

Legitimate, and it names the same defect the blocker names from the other end:
the completion read belonged where the compaction is run, not where one caller
happens to await it. providers/acp.py was already in the diff, so there was no
scope argument for leaving the cause alone.

Fixed by moving the read into AcpProvider.compact() and
AcpSessionHandle.compact(). Those two methods own running the /compact turn,
so they own reporting what came of it; for a member of
ACP_BACKENDS_INLINE_COMPACTION the drained turn IS the result, which is exactly
the fact only the seam is positioned to know.

The symptom-level read is gone rather than kept alongside it. A test asserts
compacts_inline does not appear in _compact_in_place, so the per-call-site
form cannot return without failing.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=8f5b9a74ba8f (Item 5: three byte-identical copies of one wording)

Legitimate. I wrote _COMPACT_UNMANAGED into feishu, wecom and weixin verbatim,
and the pre-existing _COMPACT_AUTO_MANAGED was already three copies, so the
section's claim that "the words stay local" described nothing. Three copies is
three places to edit and three places to drift.

Fixed by the Subtraction the item asks for. One
compact_unsupported_reply_zh(backend) in messaging/commands.py, beside
compaction_is_harness_managed and choosing between the two sentences by the
same membership the English reply reads. Six string copies became two, and the
three surfaces now import one function and pass the backend id.

grep over src/kiro_crew finds each Chinese sentence exactly once, both in
messaging/commands.py. messaging/dispatch.py and messaging/renderer.py
already carry Chinese strings, so this is the module's existing shape rather
than a new kind of content in it.

The docstring states the condition under which a surface keeps its own string:
wording that genuinely differs. What it forbids is a second surface copying
this text verbatim back into itself.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 19, 2026
@iamwhatever
iamwhatever force-pushed the fix/compaction-audit-other-backends branch from dbb4807 to b70963c Compare September 19, 2026 05:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=6cd5f1ca91ce (the specs still describe kiro/claude as the only members)

Legitimate. session.md named two members and described the decline as the only
other arm, and harness-onboarding.md's capability-set table had no row for
either new set. A spec that contradicts the code it documents is worse than one
that omits it, because a reader trusts it.

session.md's compaction bullet now names all five ACP_BACKENDS_COMPACT
members, splits them by where the done signal lands, says that the inline answer
lives on wait_for_compaction() and why (both routes to a compaction reach it,
the manual one through provider.compact() and the autocompact through
stream_command("/compact")), and lists the three arms a non-member takes:
declined for ACP_BACKENDS_HARNESS_MANAGED_COMPACTION, recycled for
ACP_BACKENDS_CONTEXT_RECYCLE, declined-and-warned for a backend in neither.

harness-onboarding.md's table gains three rows —
ACP_BACKENDS_INLINE_COMPACTION, ACP_BACKENDS_HARNESS_MANAGED_COMPACTION and
ACP_BACKENDS_CONTEXT_RECYCLE — each stating what a non-member gets, which is
the column that table exists for. ./scripts/docs-lint.sh passes.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

accepted-and-deferred — span=96f602a99be8 (the abrupt-restart UX gap has no owner)

Legitimate. A recycle backend's session is restarted with no warning, and the
soft-threshold nudge that would warn is suppressed for it. The suppression is
right for kas, whose context shrinks on its own and whose /compact advice
cannot work; it is wrong for a backend Crew is about to restart.

Deferred rather than fixed here because it is not a condition change. The
existing nudge text tells the user to run /compact, which a recycle backend
does not have, so warning them needs a THIRD nudge string on each of ten
channel surfaces. This PR already carries the memberships, the seam fix, a
three-way reply split and two spec updates; that on top would not be reviewable.

Tracked: #11949, labelled deferred-finding, assigned, with
Due: 2026-11-30 in the body. It names the suppression sites, the membership to
read, the instruction that the three Chinese surfaces take the shared wording
rather than a fourth copy, and the per-surface test that closes it.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

rebutted — span=d93262893941 (fold out the caller-side compacts_inline gate)

The premise is now half true and the conclusion does not follow. The done-signal
KNOWLEDGE did move to one layer: wait_for_compaction() answers completed
from the capability for an inline member, so chat_runner no longer needs the
gate to avoid a strand. That part of the suggestion is satisfied by the seam.

But the branch is not redundant, because the two arms differ in more than the
wait. The else arm broadcasts chat_message role=compacting, which disables the
composer while the result is pending. Both arms already share the rest —
_restore_skills_context_after_compaction(), _append_compaction_notice and
broadcast_context_usage are in both. So folding the gate out does not delete
duplicated logic; it changes what an inline backend's user sees, adding a
disable-then-enable flicker on a compaction that returns in the same tick.

That makes it a UI-shape decision rather than a dead branch, and it is
disproportional to settle inside this PR: chat_runner.py is the largest module
in the repo, the change lands on the dashboard's user-visible manual /compact
path, and the finding is a Suggestion. The gate's own comment already reads as a
capability question rather than a harness check, so it does not reintroduce the
per-harness branching this PR removed.

If the flicker is judged acceptable, the fold-out is a four-line deletion and a
better shape. That is a maintainer's call on the UI, not a correctness fix, so I
have left the code correct and said why rather than changing it unasked.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

rebutted — span=8736e1077a95 (pi and goose rest on source, not a wire capture)

The fact is right and stated in the PR body: pi answers Authentication required and goose Failed to resolve provider: GOOSE_PROVIDER on this host, so
neither could be driven. I cannot produce the capture the clearing condition
asks for, and I will not claim one.

Rebutted on the evidence, not on cost. For the one question these memberships
turn on — does the compaction finish inside the session/prompt turn — the
dispatcher source is a STRONGER answer than a capture, because the return is
literal rather than inferred. pi-acp 0.0.33 dist/index.js:2074: intercept
/compact, await session.proc.compact(...), emit one agent_message_chunk,
return { stopReason: "end_turn" } — nothing after it can emit a status.
goose 1.50.1 agents/execute_commands.rs:174 + acp/server.rs:2314:
on_prompt → Agent::reply → execute_command dispatches /compact to
handle_compact_command before a model turn starts, and goose's own
command_starts_turn("/compact") is false with its suite pinning that. A
capture would show the same end_turn these two lines already guarantee.

On the stated consequence — "if the turn shape is wrong, the new seam lies" —
the blast radius is smaller than a strand, in the safe direction. A wrong inline
membership makes wait_for_compaction() return completed while the harness is
still summarizing: the user is told slightly early and the meter resets early.
The old failure mode was the opposite and worse — the full
COMPACT_WAIT_TIMEOUT_SECS burned with the turn semaphore held, then a recycle
that destroyed the conversation. No data is lost either way in the new arm,
because the harness completes its own compaction regardless of when Crew reads
the result.

One-way-door check: neither membership is one. Removing pi or goose from both
sets restores exactly today's decline, and the three-way reply split means the
honest sentence for them already exists. So a later capture that contradicts
this is a two-line revert, not a migration.

I am not asking for this to be waived as too expensive. If the maintainer wants
the capture before these two land, the smaller change is to drop pi and goose
from both sets in this PR and keep opencode, whose capture IS in the body — say
so and I will cut it that way.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

accepted-and-deferred — span=9525751fa34c (hoist the duplicated inline-completion pair)

Legitimate, and the trigger it names is the right one: the pair lives twice today
because the two shapes read their turn state from different owners —
AcpProvider asks AcpClient.turn_finished_cleanly() across a wrapper boundary,
AcpSessionHandle reads its own fields. Hoisting them now would mean a helper
parameterised over that difference, which is more structure than two members
justify.

Deferred to the moment the suggestion itself picks: when #11973 admits pi and
goose, ACP_BACKENDS_INLINE_COMPACTION goes from two members to four and the drift
risk becomes worth the abstraction. Added to that issue, so whoever lands the
captures sees it rather than rediscovering the duplication.

The two are not free to drift silently meanwhile.
test_the_arm_is_on_the_wait_not_on_compact asserts both classes carry the arm on
wait_for_compaction and neither carries it on compact, in both directions — so a
change that moved or dropped one copy turns that test red rather than shipping.

@iamwhatever
iamwhatever force-pushed the fix/compaction-audit-other-backends branch from 99d1742 to 8b20ced Compare September 19, 2026 09:56
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 19, 2026
@iamwhatever
iamwhatever force-pushed the fix/compaction-audit-other-backends branch from 8b20ced to 5ca16f9 Compare September 19, 2026 10:26
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Sep 19, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=399217568b6f (recycle emits a false compaction-success notice)

Correct, and it is the sharpest possible finding on this PR: the change exists to
stop Crew saying untrue things about compaction, and the arm I added announced
itself with 🔄 Auto-compacted at N%. on a session whose history had just been
discarded. I had noticed the notice wording early and judged it out of scope. That
was wrong — it is not adjacent to the bar, it IS the bar.

The distinction already existed one layer down: _fire_compact_callback computes
recycled from the _recycling marker to keep a recycle out of the success
counter. It just never reached the callback. Now it does, as a named outcome
(COMPACT_OUTCOME_COMPACTED / COMPACT_OUTCOME_RECYCLED) on the protocol, because
success cannot carry it: a recycle IS a success to a caller that only needs to
know the session has headroom again.

The dashboard gained the second sentence rather than reusing the first:

♻️ Context reached N% and this backend cannot compact, so the session was restarted. The conversation above is still here; the agent no longer remembers it.

That answers the question the old notice left the user to discover by asking the
agent something it could not recall.

Reach is wider than my own arm, deliberately. The pre-existing
compaction-failed-so-recycle path fires the same callback, so it was mislabelled
too and is now correct; three test_session cases that asserted the old label
assert outcome="recycled" with a line saying why. _CompactCallback on the
session facade mirrors the coordinator's protocol exactly, including the default,
so the two cannot disagree about what a registration must accept — mypy caught
that, and it is clean over 1641 files.

Pinned by test_the_callback_is_told_it_was_a_recycle,
test_a_compaction_is_not_reported_as_a_recycle (so the outcome is not hardcoded),
and test_the_two_notices_are_different_sentences, which asserts the recycle notice
does not contain the word "compacted". 523 tests pass across the touched suites.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=1ebd9b37e14c ("backend in neither" contradicts execution)

Correct. _recycle_unmanaged's docstring described the population from the FIRST
design, where the recycle was whatever fell outside two sets. Once it became a
positive membership, the only sessions reaching this method are
ACP_BACKENDS_CONTEXT_RECYCLE members — a backend in none of the three is declined
at the gate and never arrives.

Rewritten to name that membership and to say what happens to the population the old
sentence described: declined at the gate, not recycled. Same correction as the two
comment blocks in backends.py earlier in this review; this was the third place the
old fail direction survived, and I had been fixing them one at a time instead of
grepping for the claim. There are no further occurrences —
grep -rn "in neither\|therefore gets recycled" src/ is now empty.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

rebutted — span=791bc5a19548 (Item 3: opencode proves an absent advertisement is not an absent capability)

The argument lands and it defeats my earlier answer, so I am replacing that answer
rather than repeating it. I had said the recycle membership rests on a surface
INVENTORY and an inventory is settled by the frames. opencode is the
counter-example this PR itself produced: it advertises no compaction command and
serves /compact anyway. So "deepseek advertises nothing" does not establish
"deepseek compacts nothing", and a premise I called settled is not.

What carries the membership instead is not the premise at all — it is that the arm
is a no-op if the premise is wrong. The recycle does not fire on an absent
advertisement. It fires when session.autocompact_pct is crossed by a CONFIRMED
reading, and deepseek reports a real meter. So:

If deepseek secretly compacts internally, the compaction lowers used, the gate
reads below_threshold, and _recycle_unmanaged is never reached. The hidden
capability protects the session by itself, exactly as KAS's does.
If it does not, the meter climbs and the recycle fires — which is the case the arm
is for.

The arm therefore triggers on the OBSERVED consequence of the absence rather than
on the absence, and a wrong premise costs nothing. That is a property of the gate
ladder, readable in _compaction_gate_decision: the recycle falls THROUGH the
compact_unsupported rung and still passes below_threshold, unconfirmed,
in_progress and cooldown before acting. test_below_threshold_still_wins and
test_an_unconfirmed_reading_never_spends_a_recycle pin the two that matter here.

I also cannot take the capture the clearing condition asks for: dsh is not
installed on this host, the same wall pi and goose hit. I have added the driven
deepseek /compact attempt to #11973 so it lands with the other captures — not
because the membership waits on it, but because the corpus should be able to answer
this and right now it cannot.

And the decision is recorded: the conductor owning this work item ruled to KEEP the
recycle against the bar context must not grow unbounded AND the text is truthful,
with reasoning posted in full on this PR. Which is what an earlier framing of this
item asked for — a recorded decision rather than a derived one.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=e9511ffdba58 (Item 3: the remedy needs a recorded decision)

Correctly held for a human, and the decision has now been made and recorded, which
is what this item asked for rather than a better argument from me.

The conductor owning this work item ruled: KEEP the recycle. Its reasoning, in
its words: the bar for this work is context must not grow unbounded AND the
user-facing text is truthful
— both halves. Letting a deepseek session run into its
own 8192-token window fails the first half, and that is exactly the bug class this
change was opened to fix. Declining would leave Crew measuring a window it knows
fills and doing nothing about it: the original defect wearing a more honest
sentence. The full ruling is posted on this PR, and the work item records it as this
item's decision.

The ruling carried a condition, and it changed the code rather than just the record:
the recycle text must say plainly that Crew restarts the session BECAUSE the harness
has no compaction path. It previously stated both facts as adjacent sentences and
left the reader to join them.
test_the_recycle_arm_states_its_cause_not_just_its_outcome now pins all three
claims — absent compaction, the restart, and the link — on each of the four surfaces
that carry the arm.

On the base spec line this item cites: session.md's "A backend OUTSIDE
ACP_BACKENDS_COMPACT is declined instead" is updated in this diff, not left to
contradict the code. It now names the three arms a non-member takes — declined for
ACP_BACKENDS_HARNESS_MANAGED_COMPACTION, recycled for
ACP_BACKENDS_CONTEXT_RECYCLE, declined-and-warned for a backend in neither — so
the spec and the behaviour agree about which population gets which.

What the decision explicitly did NOT waive is the ordering complaint: #11949 still
tracks warning the user before the restart, and this PR's body says so.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=ceeae6a74edd (a failed kiro-cli compaction gets the uncompactable notice)

Correct, and it is the defect my own previous fix introduced. I gave the recycle one
notice, but TWO causes reach _recycle_held: a backend that cannot compact at all,
and a backend that can and whose in-place /compact timed out or errored. The
_recycling marker cannot tell them apart, so a kiro-cli or opencode user whose
compaction merely failed was told "this backend cannot compact" — false about a
harness that has the capability and used it unsuccessfully. Exactly the class of
untruth this PR exists to remove, reintroduced by the fix for it.

Split into two outcomes, because the difference is known only to the caller:
COMPACT_OUTCOME_RECYCLED for the failure path, and
COMPACT_OUTCOME_RESTARTED_UNCOMPACTABLE for the arm where nothing could have
compacted. _recycle_held takes an explicit uncompactable keyword rather than
inferring it — _recycle_unmanaged is the only caller that passes it — and
_fire_compact_callback consumes the marker at the end of the same recycle so a
later one on the same key cannot inherit the label.

Three notices now, and only one of them may name a missing capability:

  • compacted: 🔄 Auto-compacted at N%.
  • compaction failed: ♻️ Compaction didn't succeed at N%, so the session was restarted instead. …
  • nothing could compact: ♻️ Context reached N% and this backend cannot compact at all, so the session was restarted. …

test_the_three_notices_are_three_different_sentences asserts all three differ,
that neither restart claims a compaction, that both tell the user the agent no
longer remembers, and specifically that "cannot compact" appears in the
uncompactable one and NOT in the failure one. The three test_session failure-recycle
cases keep outcome="recycled", which is now the label that makes no capability
claim. 483 tests pass across the touched suites; mypy clean over 1641 files.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=d098b2f2b140 (providers.md still describes a single decline)

Correct, and it is the third spec I had to be told about. session.md and
harness-onboarding.md were updated earlier in this review; providers.md kept
saying the auto-compact path "declines with compact_unsupported" for every backend
outside ACP_BACKENDS_COMPACT, and its H14 capability row named only
manual_compact_unsupported_backend.

The compaction paragraph now names all three arms and what distinguishes them:
harness-managed declines (and costs nothing, because
summarization_completed resets the meter), ACP_BACKENDS_CONTEXT_RECYCLE is
recycled through _recycle_unmanaged, and a backend in neither declines and is
logged at WARNING. It also records that the recycle arm falls THROUGH the decline
rung so unconfirmed / in_progress / cooldown still run first, and that the
callback reports which arm ran so a surface cannot announce a summary that never
happened — with the note that only restarted_uncompactable may claim a missing
capability, since a kiro-cli timeout reaches recycled.

The H14 row gains compaction_self_managed and compaction_unmanaged_backend, with
the reason they are three questions rather than one: collapsing them is what told a
deepseek user their harness summarizes on its own. ./scripts/docs-lint.sh passes.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=6b560f2c2208 (a human should accept the interim warning gap)

This item asks for exactly one thing — that a human, not I, accept shipping the
recycle before its warning — and that has now happened, so I am recording it rather
than arguing it.

The conductor owning this work item ruled to KEEP the recycle, with the gap
weighed explicitly. Its reasoning: the bar is context must not grow unbounded AND
the user-facing text is truthful
, both halves, and letting a deepseek session run
into its own 8192-token window fails the first half — the exact bug class this change
was opened to fix. The full ruling is posted on this PR and the work item records it
as this item's decision.

What the ruling did not waive is the ordering, which is what this item is really
about. #11949 tracks the per-surface pre-restart nudge, is labelled
deferred-finding, assigned, carries Due: 2026-11-30, and names the ten surfaces,
the membership to read, and the instruction that the Chinese surfaces take the shared
wording rather than a fourth copy. The PR body names it as a known follow-up.

The interim is not silent, which is the part that changed since this was first
raised. The /compact refusal tells a deepseek user, before anything happens, that
the backend cannot compact and that Crew will therefore restart the session — the
causal form the ruling required, pinned by
test_the_recycle_arm_states_its_cause_not_just_its_outcome on all four surfaces.
And the restart itself now announces what it was: ♻️ Context reached N% and this backend cannot compact at all, so the session was restarted. The conversation above is still here; the agent no longer remembers it. So the user is told the rule in
advance and the event afterwards; what #11949 adds is the warning at the moment it is
about to happen.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=1bd65a1f7be3 (Item 3: a spec-pinned decline replaced by the erasing arm)

Two things this item is right about, and both are now answered rather than argued.

The decision is recorded. The conductor owning this work item ruled to KEEP the
recycle. Its reasoning: the bar is context must not grow unbounded AND the
user-facing text is truthful
, both halves, and letting a deepseek session run into
its own 8192-token window fails the first half — which is the precise bug class this
change was opened to fix. Declining would leave Crew measuring a window it knows
fills and doing nothing about it: the original defect wearing a more honest sentence.
The ruling is posted in full on this PR and the work item records it as this item's
decision, which is what an earlier framing of this finding asked for — a recorded
decision rather than one derived by the author from the evidence.

The spec no longer contradicts it. "A backend OUTSIDE ACP_BACKENDS_COMPACT is
declined instead" is gone from session.md, replaced by the three arms and which
population takes each. harness-onboarding.md's capability table names all three
sets with what a non-member gets. And providers.md — which still said the same
thing until this push — now describes the three-arm gate and lists
compaction_self_managed / compaction_unmanaged_backend in its H14 row. So the
pinned sentence was not left to disagree with the code; it was updated in the diff
that changed the behaviour.

On the arm itself: the ruling carried a condition that changed the code, not just the
record. The recycle text must say plainly that Crew restarts BECAUSE the harness has
no compaction path, which it previously left the reader to infer from two adjacent
sentences. Four surfaces now state it, and
test_the_recycle_arm_states_its_cause_not_just_its_outcome pins all three claims on
each. The restart notice names itself too, and only that notice may claim a missing
capability — a kiro-cli session whose compaction merely timed out gets a different
sentence.

#11949 still tracks the pre-restart warning, and #11973 the driven deepseek capture.
Neither is waived by the ruling; both are owned, dated and assigned.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

fixed — span=399217568b6f (the outcome is dropped on the channel leg)

Correct, and it is the same defect I claimed to have fixed one round earlier. I
threaded outcome into the dashboard notice and left _notify_channel_compaction
calling through with success= only — so a Slack, Telegram, Discord, Teams, Webex,
feishu, WeCom, WeChat, WhatsApp or iMessage user still read "Context reached N% and
was auto-compacted. Earlier turns are now a summary" about a session that had been
REPLACED. The vocabulary exists to stop exactly that sentence, and I had left the
surface most users actually read on the wrong side of it.

Threaded end to end now: _on_compacted → _notify_channel_compaction →
deliver_channel_compaction_notice → notice_text, both the Slack leg and the
governed cross-surface transport leg, which renders from the RESOLVED channel type so
a unified: DM bucket still gets its own wording.

Two new channel strings, matching the dashboard's split, and only one of them names a
missing capability:

  • CHANNEL_RESTART_NOTICE — "compaction didn't succeed, so this session was
    restarted. The messages above are still here; the agent no longer remembers them."
  • CHANNEL_RESTART_UNCOMPACTABLE_NOTICE — "this backend cannot compact at all, so
    this session was restarted. …"

Both carry the per-namespace {new_cmd}, since starting fresh is the one action left
to the user and that command already differs per channel.

test_the_channel_notices_split_the_same_three_ways asserts three distinct texts,
that neither restart says "auto-compacted", that both name the loss, that
"cannot compact" appears only in the uncompactable one, and that an UNKNOWN outcome
falls back to the compacted wording rather than raising — this renders a user-facing
notice and a KeyError here would drop it silently. 1392 tests pass across the
notice, dashboard, session, metrics and compaction suites.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=4ed124996b6e — the destructive arm and its pre-warning land in reverse order. Accepted; the sequencing is deliberate and #11949 carries the nudge.

Your read of the state is right, and the description concedes it because it is true: the soft-threshold nudge is suppressed for every non-member, so a deepseek user's first signal is the after-the-fact restart notice.

Why this order rather than the other. Without the recycle a deepseek session runs into its 8192-token wall and ends anyway — the same loss of history, no notice at all, and no bound on the context in between, which is half the bar this change exists to meet. Deferring deepseek's membership to ship alongside #11949 buys better sequencing of the same destruction at the price of leaving that leak open for a release. The ruling on this PR took that trade explicitly and is posted in this thread.

What I did tighten is the part inside this diff's reach: the notice now names its CAUSE rather than only its outcome — Crew restarted the session because the harness has no compaction path — on all four surfaces, pinned by test_the_recycle_arm_states_its_cause_not_just_its_outcome. A user who reads it learns why, and can act before the next one.

The pre-threshold nudge itself is #11949 (deferred-finding, due 2026-11-30). It spans ten surfaces and I am not going to claim it fires here: it does not, and that is the open half of your item.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=0079fae88041 — the recycle's benefit rests on unverified wall behavior, so if deepseek does self-summarize Crew destroys live sessions at 70% for nothing. Accepted as the residual risk it is; the driven capture is out of my reach on this host and the surface stays removable.

This is the correct question to ask of the previous round's correction. Taking the overreach out of the comment did not make the wall behaviour known — it made the not-knowing explicit, and you are right that the recycle's value is contingent on which way it resolves.

Why I cannot close it here. The clearance is a driven capture of deepseek crossing its own window, and the deepseek captures in the corpus were taken off dsh --profile acp 0.0.1 against a locally served model. That adapter is not installed on this host and is not on any path I can reach, so I cannot drive the window; producing the capture needs an environment I do not have rather than time I did not spend. Filed as the deepseek drive on #11973 (deferred-finding, due 2026-11-30).

What bounds the residual in the meantime. The failure mode if the harness does summarize at the wall is a session restarted earlier than necessary — history lost that would have been summarized — which is bad and is bounded by being the same destination a FAILED compaction already reaches on every other backend, announced with its cause rather than as a compaction. The failure mode if it does not is a session that hits 8192 and ends with no bound and no notice. The membership is one frozenset entry (ACP_BACKENDS_CONTEXT_RECYCLE = {DEEPSEEK}), so the reversal is deleting a name, not unwinding a mechanism: the declined-and-WARNING arm that codex, pi and goose take is already built and already tested, and deepseek falls into it the moment the capture says it should.

I am recording this as accepted risk rather than answered, and it is a maintainer's call which way to resolve it — which is also what the first-principles lane is asking for on its own item.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Note on the GPT lane's blocking finding from the previous head (session_compaction.py:592, failed teardown leaks the recycle classification) — it is fixed rather than overridden, so the lane carries no finding on a176e77d8ed0 and this is a note rather than a disposition.

_recycle_held set uncompactable_recycles on entry and _fire_compact_callback consumed it on the way out, with unlink_session_queue and provider.shutdown() in between — so a provider that raised during teardown stranded the marker. The discard is now paired with the _recycling pop inside the same identity guard: the marker's life is exactly this recycle, scoped to this session object, so a racing replacement under the same key cannot have its marker cleared by a predecessor's teardown.

I did not take the pre-drafted override even though the adjudicator's harm rung (LOW, self-correcting) reads fair, because the thing it self-corrects to is the one sentence this change set exists to stop emitting: telling a kiro-cli user whose compaction merely failed that their backend cannot compact at all.

Pinned by test_a_failed_teardown_does_not_leave_the_cause_behind, which drives the real condition — a deepseek recycle whose provider.shutdown() raises — asserts the callback never ran, asserts the marker is gone anyway, then fires the next recycle on that key and asserts it reports recycled rather than restarted_uncompactable. Verified RED against the parent commit.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=8cfe5de45371 — Item 2, the recycle-at-threshold default rests on a premise the diff declines to claim. Accepted; the premise cannot be settled from this host, so it goes to a maintainer decision rather than to another round of my own prose.

The inheritance is real and I put it there: last round's correction replaced an unverified assertion ("its harness carries compaction internally") with an explicit non-claim, and the non-claim is honest about the same gap the assertion papered over. Making the premise visible does not discharge it.

Of the two clearance paths, the driven capture is out of reach here rather than merely unspent. The corpus captures were taken off dsh --profile acp 0.0.1 driving a locally served model; that adapter is not installed on this host and is not on any path I can reach, so deepseek's window cannot be driven from where I am. It is filed as the deepseek drive on #11973 (deferred-finding, due 2026-11-30).

That leaves the maintainer record as the live path. The decision itself has already been made and is posted in this thread: the recycle stays, because the bar for this change is that context must not grow unbounded AND the text must be truthful, and letting a deepseek session run into its 8192-token wall fails the first half. What is missing is that decision recorded in the form this lane reads, which is a maintainer's to enter and not mine to self-authorize — a wrong override here ships exactly the class of unproven claim the fence exists to stop.

For the record of what that decision is choosing between, since this is the part I can establish: the observable half is settled by the two committed captures — no available_commands_update at all, session/load answering "Method not found", advertised capabilities carrying no compaction anything — so whatever the harness does at the wall, no compaction path on that surface answers a threshold Crew has already crossed. The unsettled half is whether the harness summarizes for itself there, in which case the recycle destroys history at 70% that would have been summarized. Reversal is one frozenset entry: remove deepseek from ACP_BACKENDS_CONTEXT_RECYCLE and it falls into the declined-and-WARNING arm codex, pi and goose already take, which is built and tested in this diff.

buluoray
buluoray previously approved these changes Sep 19, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at head a176e77d8ed0ce0db452a9145385f26d05269591. No blocking findings — approving on correctness. One item below is a product decision rather than a defect, and I want it named rather than buried: read point 1 before you merge.

Verified against source rather than the description — the hard invariant first, since this PR touches several backends' identity predicates:

  • Positive identity holds everywhere. No touched predicate uses not is_X. compaction_self_managed is backend in ACP_BACKENDS_COMPACT or in ACP_BACKENDS_HARNESS_MANAGED; compaction_unmanaged_backend returns an id only if backend in ACP_BACKENDS_CONTEXT_RECYCLE; compact_refusal_arm checks HARNESS_MANAGED, then CONTEXT_RECYCLE, then falls through to UNCLASSIFIED. Crucially the destructive recycle arm is granted only by explicit CONTEXT_RECYCLE membership, never by exclusion — checked across session_compaction.py, providers/acp.py, providers/base.py and messaging/commands.py.
  • State loss on the changed path. opencode's move into ACP_BACKENDS_COMPACT / INLINE_COMPACTION compacts in place, so process and session survive. The inline completed short-circuit fires only when turn_finished_cleanly() (positive end_turn, not cancelled), and test_a_cancelled_turn_is_not_a_completed_compaction pins that — so a false completed cannot silently reset the meter.
  • No hardcoded model id. The only fallbacks are getattr(..., "backend", ACP_BACKEND_KIRO) — a backend id, matching the pre-existing manual_compact_unsupported_backend pattern and failing safe to compactable / no-recycle — plus getattr defaults that fail CLOSED on test doubles (_compacts_inline, _inline_turn_finished_cleanly).
  • Files read: session_compaction.py, providers/acp.py, providers/base.py, acp/session_handle.py, acp/session_provider.py, acp/client.py, messaging/commands.py, dashboard/state.py, chat_compaction_notice.py, the opencode compact-live.jsonl fixture, and the 976-line test_compaction_other_backends.py (seam, gate end-to-end, callback-outcome and refusal-text arms all pinned with stated RED-before states).

Needs your judgment, not a code change:

  1. ACP_BACKENDS_CONTEXT_RECYCLE = {ACP_BACKEND_DEEPSEEK} — deepseek's recycle at autocompact_pct is destructive (it discards conversation memory) and it ships before the advance-warning nudge, since #11949 is deferred. A deepseek user therefore gets only an after-the-fact notice. Both advisory lanes raise exactly this. I am not treating it as blocking: it is positively gated by explicit membership, reversible with a one-line data change, and it replaces unbounded growth-until-window-death with a bounded restart. But it is a real tradeoff, and it compounds with point 2 — so if you would rather land the nudge first, say so and I will withdraw the approval.
  2. That membership also rests on deepseek's unverified wall behaviour: the description concedes it was not driven to see whether deepseek self-summarizes at its own window. If it does, the 70% recycle discards memory a no-op would have preserved. Bounded and reversible, so not blocking, but it is the measurement that would retire point 1.
  3. chat_runner.py keeping the caller-side compacts_inline gate is correct and your rebuttal to Design stands: the two arms differ by a role=compacting composer-disable broadcast, so folding them would change UI behaviour rather than delete dead code.

Bot verdicts on this SHA: GPT 5.6 no blocking findings; Opus 4.8 no blocking findings, having independently traced gate → _recycle_unmanaged → _recycle_held and falsified a recycle-loop hypothesis (the no-cooldown shape already exists on the pre-existing _compact_in_place failure path and has not looped, because real windows leave headroom); Design 🟡 CONCERNS and First Principles 🟡 CONCERNS, both advisory and both on the deepseek question above. The disposition comments citing dbb480 / b70963 are from prior revisions.

bolichen97
bolichen97 previously approved these changes Sep 19, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved: readiness gate passed

…manage

Crew only ran /compact for kiro-cli and claude. Every other backend got one
answer: skip it, and tell the user "this backend manages compaction
automatically". Driving each harness says that answer was right once out of five
times.

opencode DOES serve /compact and finishes it inside the prompt turn, on a live
capture, so it joins ACP_BACKENDS_COMPACT and ACP_BACKENDS_INLINE_COMPACTION. For
an inline member wait_for_compaction() answers from the capability instead of the
queue -- but only when the turn reached its own end boundary uncancelled, since a
cancelled turn compacted nothing. That answer sits on the WAIT because both routes
to a compaction reach it: the manual entry points via compact(), the autocompact
via stream_command("/compact").

KAS is the one correct skip, so the reason becomes a membership it can be checked
against: ACP_BACKENDS_HARNESS_MANAGED_COMPACTION.

deepseek compacts nowhere Crew can see, so a skip bounded nothing.
ACP_BACKENDS_CONTEXT_RECYCLE names it and its threshold now recycles through the
path a failed compaction already takes. The recycle is granted by membership and
never by exclusion: a harness in none of the three sets declines, and the gate
logs a WARNING naming the missing decision.

pi and goose look inline in source but could not be driven here, so they stay out
rather than join on the weaker evidence class (#11973). codex is the sibling
branch's item. All three now get a refusal that promises nothing instead of a
claim nobody had evidence for, chosen by one compact_refusal_arm() that every
surface maps to its own wording.

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-approving at head 6f154dc861e6fb18b0b217c9a9a28dcbca5a4606. My earlier approval was on a176e77d and was voided by the rebase under require_last_push_approval, which is correct behaviour, not a problem.

Checks are green at this head. 0 failing, 0 pending, PR Readiness SUCCESS, both CodeBuild aggregates SUCCESS. Six rows read as CANCELLED in the rollup — Automated Rule Check, GPT 5.6 Review, Screenshot Evidence, Inclusive Language, SAST (Semgrep), PR Hygiene — and each has a newer same-named SUCCESS started 8–76 seconds later, so they are concurrency supersessions of the pre-rebase dispatch, not failures. Collapsed to the newest attempt per check identity, everything is green.

Blocking lanes on this head: GPT 5.6 no blocking, Opus 4.8 no blocking. Design and First Principles are CONCERNS, which is advisory.

The rebase did not move anything I had verified. Re-read at 6f154dc8 rather than assumed:

  • ACP_BACKENDS_CONTEXT_RECYCLE = frozenset({ACP_BACKEND_DEEPSEEK}) (agent_sdk/backends.py:983) — still one explicit positive member.
  • Every consumer answers from positive membership: acp/session_provider.py:731, providers/acp.py:681, messaging/commands.py:375, each backend in ACP_BACKENDS_CONTEXT_RECYCLE with a not isinstance(backend, str) guard ahead of it. No not is_X_backend anywhere in the diff, so harness identity stays positive per H5/H6.
  • No hardcoded model id in any added line.

The product tradeoff is unchanged and still the maintainer's to weigh, which is why I am approving the code rather than the rollout: a member of this set gets context recycle, which discards conversation memory, and the advance-warning nudge (#11949) is deferred — so a deepseek user learns about it after the fact rather than before. I judged that acceptable because the grant is explicit single-member, one line of data reverts it, and the alternative is growing until the window bursts. Two advisory lanes read it the same way. If you would rather land #11949 first, this approval should not be taken as arguing against that.

Not merging; that is the maintainer's call.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved: fix-class, readiness:passed, no conflict.

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.

3 participants