Repository navigation
fix(cron): retry ACP process death on the type, not the message wording - #7396
SebastianYuSun wants to merge 1 commit into
Conversation
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify no third call site re-prompts an already-worked session — an inherited [DESIGN-REVIEWED] d616eaf |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsI've verified the load-bearing claims against the actual source:
The candidate list contained no candidates, and my independent falsification found no grounded defect in the changed lines. No findings. [OPUS-REVIEWED] d616eaf |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the framing claim on the real transport: a child that read the full prompt line never fails Not justified as shipped
What this change shipsInventory (7 items) — 6 justifiedIntent: FIX — a cron job whose ACP child dies on the prompt write is hard-failed toward auto-pause because the retry predicate matches message wording that death doesn't carry.
Verified against base: [FIRST-PRINCIPLES-REVIEWED] d616eaf |
92c3b5f to
2621b28
Compare
|
Rebased onto The finding was correct. The fix is not the prescribed revert. Reverting the type arm would also drop the three pipe-broken sites this PR exists to cover, and it would put the retry decision back on exception wording, which is the defect class itself. Instead the guard now excludes the one subclass that is unsafe to retry: (isinstance(exc, AcpProcessDied) and not isinstance(exc, AcpToolStalled))
The legacy substring arm is still there for the five plain- Tests: |
2621b28 to
8125735
Compare
8125735 to
20c259a
Compare
|
Round 4 on GPT 5.6 (blocking) — closedThe finding is right: Enumerating every raise site rather than reasoning from the taxonomy:
The last two are sites First-Principles named that I had missed, and The invariant is now about when the death was discovered, not which subsystem noticed. Only transport-write sites are retryable, which is exactly the class this PR exists to cover. Not the prescribed revert, for the third round: reverting the type arm drops the three pipe-broken sites this PR is for, puts the decision back on message wording (the defect class), and leaves the mid-turn hazard untouched at all four sites. First Principles (advisory) — subtraction taken
The undeclared-surface point is fixed: the description now lists all four items (predicate, attribute + kwarg, two The false docstring premise is rewritten to state the real invariant, and records that the earlier wording was false so it is not reintroduced. Deferred, with reasons
Tests
903 passed across the cron, ACP-client, ACP-error-surface and slack-gateway suites. All local gates green, including the repo's own 14 bare-invocation script gates ( |
20c259a to
cb85ad9
Compare
Round 5 — all three lanes named the same defect, and it is realOpus 4.8 (blocking), Design and First Principles independently converged on one Measured before changing anything. The shipped predicate, driven with every
Fix, at cause. The substring arm is now scoped so a typed death is decided The default is inverted, per @Design's argumentDesign and First Principles both showed the audit was incomplete — That is two consecutive rounds of an incomplete enumeration, and it is the
The three sites you named are now correct without being listed, which is the point. So the test changed direction too. Asserting "every in-flight site opts out" Subtractions taken
On the one point where the lanes disagreedAn earlier round had Opus calling the hazard pre-existing while another lane called Verification
Local gates on this head: black (repo wrapper), isort, flake8, mypy over One diff-scope note: formatting the touched test file graduated it out of The |
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
cb85ad9 to
79ef804
Compare
First Principles — confirming the trade you asked about
Confirmed, and taken deliberately. Here is what the trade actually costs and buys, measured against the seven death shapes the code raises. What is given up. One shape: What is bought. Two shapes gain a retry, and one of them is the common case:
The first row is the signature that produces most ACP deaths, which is the whole reason Why the asymmetry is the right way round. A repeated mutation is silent and And it is not a silent removal. The refusal is the classification's own answer A second trade you did not ask about, because I had not measured itChecking the first one properly surfaced a larger one, on the default backend, and
Only the last row is served by The root cause is a decision two earlier rounds took deliberately. After two Your call, not mine. Three shapes, and I do not think a contributor should pick:
I have not implemented any of them. Say which you want and I will do it here, or split it |
The comment-history red is gone, and not because of anything in this diff@bolichen97 — closing the loop on the It is fixed on
It now judges only the lines a change adds, and it runs from Measured on this branch rebased onto That was the only genuinely failing check on the previous head. The rest of the red was On your rebase. It was clean and content-identical, as you said. It landed on the head The |
What unblocks this headNew head 1. The workflow runs need approval. Sixteen runs on this head sit at
The previous head's only genuinely failing gate — 2. A fork author's dispositions do not count toward the gate. The four The rule reads a repository writer's comment, and my access here is Local verification on this head, for what it is worth from outside CI: the repo's own |
The cron failure handler has a retry branch built for ACP process death, but it identified that death by string-matching the exception message for "not running" or "process exited". The most common death is discovered as a broken pipe on the next write and is worded "ACP process pipe broken: <cause>", which matches neither substring, so the branch built for process death is skipped for the signature that produces it most often. A recoverable one-off child death is recorded as a hard failure instead, marching consecutive_failures toward auto-pause. The generic transient ladder does not cover the gap either: AcpError.transient defaults to None at that raise site and the message carries no throttle or 5xx marker, so acp_error_is_transient falls back to marker-matching and returns False. The branch now reads the type. AcpProcessDied gains a resubmit_safe attribute the raising layer sets, mirroring AcpError.transient: the site that discovers a death knows whether a turn was in flight, so the cron handler reads one attribute instead of re-deriving it from a class hierarchy. The attribute is THREE-valued, and the third value is the one that matters. True means the death was discovered with no turn in flight; False means a turn may have been in flight; None, the default, means the raise site has expressed no opinion. A two-valued flag would make silence indistinguishable from a judgement, and silence is the common case: session_provider's translation layer rebuilds every shared-runtime death as AcpProcessDied(str(exc)), so the runtime's five "process not running" raises arrive carrying no verdict. Under a refusing default they would read as "unsafe" and lose the retry the wording arm had been giving them all along -- a fix for one death signature that silently deletes the retry for another. None therefore means "ask the question the handler asked before this attribute existed", not "no". This is why AcpError.transient is also None-by-default. Two sites claim safety. The prompt write marks its own death safe: a failure there means the child never received a complete session/prompt line, so it cannot have dispatched a tool. The pre-conversation liveness check marks its death safe because no conversation exists yet. That claim is about delivery only, and a caller may re-prompt a session that has already done work, so the two callers that do withdraw it. stream_and_collect withdraws it once a tool has fired in the call, reusing the sticky flag its fallback chain already refuses to replay past. The cron post-token resume withdraws it on the continuation prompt, which follows text the interrupted turn already streamed. Without both, a resubmit-safe death on a re-prompt sends the cron retry back through the ORIGINAL message on a fresh session and repeats a completed tool call. One site must state False explicitly rather than lean on the default: "Process exited during prompt" is a death that happened WITH a turn in flight, and its wording contains "process exited", so leaving it unclassified would route it to the wording fallback and retry it. A test walks the AST of all three modules that construct the exception and fails if any AcpProcessDied construction whose message literals match the fallback's substrings omits the keyword, so the one regression a three-valued flag can introduce cannot be introduced silently. It is an AST walk and not a regex because a regex matches the same phrases where they appear in prose. That check sees source literals only, so a message composed at runtime is invisible to it. session_handle._died builds its message from the runtime's death summary, which embeds "process exited (rc=N)", and all three of its call sites are mid-turn, so those deaths are retried by the fallback exactly as they were before this change. The test docstring and the comment at the consumer both name that population as a known residual rather than implying the check covers it. Closing it means _died stating a verdict from is_turn_active, which it can already see; that is a behaviour change on the default backend and is left out deliberately. The substring arm therefore stays, and its role is now the fallback for an unclassified death. It serves two populations: the five sites that spell process death as a plain AcpError, and every shared-runtime death that reaches the handler through the translation layer. It cannot out-vote an explicit verdict, because the verdict is consulted first and only a None falls through to it. The comment at the branch records both populations, so the arm's remaining reach is not read as vestigial. test/test_cron_acp_retry.py covers the pipe-broken retry, an unclassified death keeping the retry it had before the verdict existed, both sites that claim safety, the substring arm's two populations, that a mid-prompt death is not retried despite its wording, both withdrawals, and the AST invariant. Removing either withdrawal fails its own test with the replay named; dropping the explicit keyword at the mid-prompt site fails the invariant.
1929838 to
d616eaf
Compare
Round 6 — the deferred design question is now decided, and it was a regressionThree lanes on Measured both ways on the same death.
The fix
Net effect on the shared runtime, which is the population that regressed:
That backend now loses nothing and gains nothing. The direct- One site must now state It is an AST walk rather than a regex because my first attempt was a regex, and it matched Dispositions
I also ran both reviewer lanes locally against the new head before pushing, and fixed
Deliberately not in this diff
Verification on this head
Head is now |
Both PASS asks verified on
|
| site | |
|---|---|
claims True |
acp/client.py:9892 (_send_prompt retag), acp/session_provider.py:123 |
| withdraws | llm_helpers.py:2225, slack/gateway.py:1331 |
Exactly one site reads the verdict to decide a resubmit: slack/gateway.py:5674. The
other two readers are the withdrawals themselves.
The reachable graph. gateway.py:5674 sits in a handler spanning 5602-5993, whose
try protects only 5247-5601. Within that protected body there is exactly one
prompt-issuing entry, _cron_stream_with_posttoken_resume at 5284. That function
(1237-1351) is where the continuation withdrawal at 1331 lives, and beneath it
stream_and_collect's internal retry chain is covered by the withdrawal at
llm_helpers.py:2225. Two re-prompt opportunities, both covered.
The obvious candidate for a third is structurally excluded. The multi-agent
agent_sequence path also calls _cron_stream_with_posttoken_resume, at 5137 — but
that call sits outside the protected body, inside its own try at 5100-5226,
whose handlers do not read resubmit_safe. So a death on the sequential path is
handled locally and never reaches the ACP retry, which is what would be needed for
agent #1's completed tool to be replayed by a death on agent #2's prompt write.
Also checked: all three _send_prompt call sites in client.py (send_message 9062,
send_message_stream 9079, stream_events 9179) issue exactly one prompt per
invocation with no internal loop, so none is itself a re-prompt.
First Principles: "verify a child that read the full prompt line never fails _send_prompt's drain"
Confirmed by measurement on a real subprocess pipe, since this is the premise the
resubmit_safe=True claim rests on. Payload built the way _send_request builds it,
with the newline appended last:
| child behaviour | payload | drain() result |
|---|---|---|
reads the full line (terminator included), then _exit |
4 KiB, unpaused | returns cleanly, 3/3 |
reads the full line, then _exit |
200 KB, past the 64 KiB high-water mark | returns cleanly, 3/3 |
reads a prefix only (no terminator), then _exit |
200 KB | raises BrokenPipeError, 3/3 |
So the premise holds, and it holds in the paused case that the analytical argument was
least certain about. The consequence is stronger than "the claim is safe": a child that
consumed the whole line does not make _send_prompt raise at all, so no safety
claim is produced on that path. Such a death is discovered later, at a mid-turn raise
site, where it is unclassified or explicitly False.
One correction this measurement forced, already in the pushed head. The comment
justifying the claim used to assert that drain() "fails only while unflushed bytes
remain". That is false for asyncio — drain raises once the connection is recorded lost,
buffered or not. The conclusion survives, but on framing, not on drain semantics:
the terminator is written last, so any prefix the child consumed is missing its
newline. The comment now rests on the argument that actually carries it, and the table
above is what confirms the separation is clean rather than incidental.
No code change in either case. Head remains d616eafee.
Remaining state is not agent-actionable: 19 check suites are action_required with
runs=0, i.e. fork workflows awaiting "Approve and run workflows", and PR Readiness
is red as a consequence of checks never allowed to report rather than of a failure.
|
injected os.getpid() |
kill_orphan_mcps([600]) |
test expects |
|---|---|---|
| 12345 | 1 — passes | 1 |
| 600 | 0 — assert 0 == 1 |
1 |
Windows allocates pids in small multiples of 4, so 600 is comfortably reachable for a
process on a fresh runner; a Linux container's worker rarely lands exactly there, which
is why the test is green on Linux and green on most Windows runs.
Suggested fix (yours to take or leave): either patch os.getpid in that test to a
value that cannot collide, or sweep a pid that is not a plausible live pid. The sibling
tests in the same file are unaffected because they exercise
_kill_orphan_gatewayd directly and never reach the my_pid comparison.
Why this is not this diff
- Not mine to have broken. No commit of mine touches
session_pid.py,
platform_compat.pyortest_session_pid_reaper_shim.py. The test came in with fix(session): route the gatewayd orphan kill through platform_compat #7871;
the code under test with fix(sweep): reap the whole MCP-launcher orphan tree, not just its root #8304 / fix: sweep orphaned agent-spawned test runs (pytest, xdist workers) #2442 / fix(dashboard): put every dropdown on the shared components, not a native select #1741. - No linkage. The test is fully mocked and lives in an unrelated subsystem;
session_pid.pyimports nothing this diff changes (its only internal import is
mcp_gateway.shutdown_budget), and the test references none of the changed modules. - Not a sharding side effect either. This diff adds 20 tests, so I checked whether it
reshuffled--splits 4 --group 4membership and moved this test into a hostile
neighbourhood. It did not: at both my head and my base, group 4 contains the same four
tests of that module, in the same classes, with the same adjacent module
(test_session_pid_sig.py). Group 4 grew by exactly 5 tests, which matches the CI
counts (main shard 4: 24607 passed; mine: 24611 passed + 1 failed, identical 1151
skipped). - Rebasing would not help and would cost. Four commits landed on
mainsince my
base; none touches any implicated path. A rebase here would only reset the fork
workflow approval you just granted.
So this is an environment-dependent latent defect in an unrelated test, not a flake in
the "unexplained" sense — the mechanism is identified and reproducible. I have not
touched it, since it is outside this diff and fixing it here would both widen the change
and reset approval. Happy to send it as a standalone one-line PR if useful.
Head remains d616eafee. Everything else on this head is green: 79 checks, the only
other red is PR Readiness, which is downstream of this one shard.
|
🤖 Kiro Crew [operator: NicholasRBowers#a942f9ca]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author. Assessment: All four review lanes are clean on If you'd prefer I don't touch this PR, add the |
Open-PR triage (2026-10-05): PARTIALLY_COVERED by merged #15778, needs a rebase and a design decisionI compared the full merge-base diff ( Merged PR #15778 covers part of this PR, and only part. Its title is "retry a pre-dispatch ACP process death by type", and it was merged 2026-10-01. On main,
Issue #7395 is still open. Main still does not deliver two pieces of this PR: refusing the mid-turn Points to settle before or during the rebase:
Classification: PARTIALLY_COVERED (#15778), OVERLAPPING (#15905's delivery classification). No breaking change. No P0 on this head: |
|
Thank you @SebastianYuSun for this fix and for the careful write-up of the Part of it is now on main via #15778 (merged 2026-10-01, commit 4d24fde). The cron ACP-death retry now matches What main does not carry yet from this PR:
So this PR stays open for a maintainer to decide on the remaining part. Nothing else was changed on it. |
|
Thanks a lot for this fix, @SebastianYuSun. Closing because the linked issue #7395 was closed as completed on 2026-10-12, and latest main already retries cron ACP deaths on the exception type: |
Problem / Motivation
A cron job whose ACP child dies is recorded as a hard failure, even though the
failure handler already holds a retry branch built for exactly that case.
The branch looks for the words
"not running"or"process exited"in the errormessage. The most common death is found as a broken pipe on the next write, and it
is worded
"ACP process pipe broken: <cause>". Neither word appears in it, so theretry is skipped for the signature that produces it most often.
Observed on a real job:
last_status: "error",last_error: "ACP process pipe broken: Connection lost", on a job whose previous run finished normally and whosehost was not persistently broken.
Why it matters
A paused cron job never fires again.
consecutive_failuresauto-pauses a job at_AUTO_PAUSE_THRESHOLD, so a handful of one-off child deaths durably disables ahealthy job instead of self-healing.
The code reads as if this is handled, which is the worst part. The retry is right
there in the failure handler, so the behaviour looks covered.
The generic transient ladder does not catch it either.
AcpError.transientisNoneat that raise site and the message carries no throttle or 5xx marker, soacp_error_is_transientfalls back to marker-matching and returnsFalse. Bothladders miss, and control reaches
record_failure().What changed (motivation → approach → change)
The retry in
slack/gateway.pynow asks the exception's type, not its wording.Symptom: a healthy cron job collects hard failures for a death it could recover
from. Root cause: the predicate reads
str(exc).AcpProcessDiedis raised atevery site that discovers a dead child, is an
AcpErrorsubclass, and is alreadyimported at the decision site. It was simply not consulted.
Change:
AcpProcessDiedcarries aresubmit_safeverdict that the raising layersets, and the cron branch in
slack/gateway.pyreads that one attribute. Thismirrors
AcpError.transient: the layer that raises knows the classification, so itstates it instead of exporting a class hierarchy for callers to re-derive. Reading
an attribute also adds no ACP import, which
scripts/check_agent_sdk_boundary.pyrefuses.The verdict is about when the death was discovered, not which subsystem
noticed. With a turn in flight a tool may already have completed its side effects,
so resubmitting the prompt can repeat a mutation.
The verdict is three-valued, and the third value is the point.
TrueFalseNone(default)NoneandFalsemust not be the same value. A two-valued flag makes silenceindistinguishable from a judgement, so an unclassified death reads as "unsafe" and a
consumer that refuses on
Falsedrops behaviour it would otherwise keep. Thatpopulation is not hypothetical:
session_provider._translate_deadrebuilds everyshared-runtime death as
AcpProcessDied(str(exc)), so the fiveruntime.py"process not running"raises arrive unclassified. Under a refusing default theyread as unsafe and lose the retry their wording earns at the fallback — a fix for one
death signature that deletes the retry for another.
So
Noneroutes to the question the handler asked before this attribute existed,rather than answering it. This is why
AcpError.transientis alsoNone-by-default:an unclassified error falls back to the marker ladder instead of being declared
non-transient by omission. The precedent is in this repo, and matching it is what
makes the fallback arm's continued existence coherent rather than vestigial.
The two sites that claim safety, each one where the turn provably had not started:
resubmit_safeclient.py_send_promptTruesession_provider.pyruntime not aliveTrueOne site must state
Falseexplicitly rather than lean on the default."Process exited during prompt"is a death that happened with a turn in flight,and its wording contains
"process exited", so leaving it unclassified would routeit to the wording fallback and retry it. That is the one regression a three-valued
flag can introduce, so it is enforced mechanically rather than by review: a test
walks the AST of
acp/client.pyand fails if anyAcpProcessDiedconstruction whosemessage literals match the fallback's substrings omits the keyword. It is an AST walk
and not a regex because a regex also matches those phrases where they appear in
prose — including in the docstring that explains the rule.
The claim is about delivery only, so a re-prompt withdraws it. A write can
establish that its own request never reached the child. It cannot establish that
nothing ran before it, and two callers re-prompt a session that has already done
work. Each withdraws the claim from what only it can see:
src/kiro_crew/llm_helpers.pystream_and_collectslack/gateway.pycron post-token resumestream_and_collectreuses the sticky flag its own model-fallback chain alreadyrefuses to replay past, for the same reason: a tool can complete an external
mutation before any text streams. Without either withdrawal, a resubmit-safe death on
a re-prompt sends the cron retry back through the original message on a fresh
session and the completed tool runs twice.
Which deaths the cron retry accepts, before and after:
pipe brokenon the prompt writeRuntime is not alive, no conversation yetProcess exited during promptpipe brokenanswering a mid-turn child requestAcpError("ACP process exited (code=…)")AcpError("ACP process not running")AcpError🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged
The two deaths that could not be retried now can be, and the one death that could
repeat a finished tool call no longer is. Everything else answers the same as it
did.
Why a failure at
_send_promptimplies nothing ran. The guarded region iswrite()anddrain()together, and the claim holds at either.write()failingmeans no byte was queued for the child.
drain()failing means bytes are stillqueued, and the wire is newline-delimited JSON-RPC, so the child never got a whole
session/promptline and cannot run a tool for a request it has not finishedreading. A child that read the whole payload drains clean even if it dies right
after. A child that read a prefix does raise here, and a prefix is not a request.
The claim sits at
_send_prompt, not at the transport write, because a transportwrite cannot know turn state.
_send_requestalso carriessession/steerandcommands/execute, and_send_response/_send_errorexist only to answerrequests the child raises mid-turn. Tagging the shared write safe would mislabel
most of its callers: a cron turn finishes tool 1, the agent asks permission for tool
2, the child dies, and the resubmitted prompt runs tool 1 again.
The wording arm stays, scoped to plain
AcpError. Five raise sites spell processdeath as a plain
AcpError, so dropping the arm would silently stop retrying allfive. Scoping matters the other way too:
AcpProcessDied("Process exited during prompt ...")containsprocess exited, so an unscoped arm out-votes that death'sown refusing verdict. Adding
"pipe broken"to the substring list instead would fixthis one case and leave the decision coupled to wording, which is the defect class.
Which backend the two directions reach, measured. The default
agent.acp_backendis served by the sharedAcpRuntimethroughAcpSessionProvider, which translates every runtime death toAcpProcessDied(str(exc))carrying no verdict.AcpSessionHandledoes not routethrough
AcpClient._send_prompt, so the safe claim is not reachable there. Drivingboth predicates over the shapes that path raises:
process not running(5 raise sites)pipe broken: …runtime is deadSo on that backend this change costs nothing and adds nothing. All three shapes
arrive unclassified,
Noneroutes them to the wording fallback, and the fallbackanswers exactly as it did before. That is the whole reason the default is
None: anearlier revision of this PR defaulted to
False, which turned row one into a hardfailure and silently deleted a retry on the default backend while fixing a different
one. Measured both ways on the same death —
AcpProcessDied("process not running")retries under
Noneand does not underFalse.What this backend does not gain is a retry for its
pipe brokendeaths, becausethe fallback it lands on does not match that wording. Giving it one means classifying
the runtime's own prompt-initiating write the way
AcpClient._send_promptisclassified here. That is a behaviour addition on a path this PR does not otherwise
touch, and it needs the delivery argument re-verified against the runtime's transport
rather than
AcpClient's, so it is left out deliberately rather than overlooked.Known residuals, deliberately out of scope. Three resubmit decisions still run
without the verdict, and the comment at the
slack/gateway.pybranch says so:AcpErrorsites carry no verdict, so wording decides them, andfour are reachable with a turn in flight: the EOF read raises
"ACP process exited (code=...)"from the prompt loop, and the"not running"checks guard the writesanswering a mid-turn child request. A death there is still retried — exactly as
before this change. Typing those sites also changes the answer for the pre-turn
callers sharing the same message, so it is a behaviour decision rather than a
relabelling.
dashboard/chat_runner.pyresubmits onAcpProcessDiedwithout reading it.task_executor.pydoes the same.All three are pre-existing, in files this change does not touch, and the right
non-resubmit behaviour differs for a foreground turn versus a cron wake.
Residual 1 is also why the substring arm stays rather than being retired in this
diff. It now serves two populations: those five plain-
AcpErrorsites, and everyshared-runtime death arriving unclassified through
_translate_dead. It cannotout-vote an explicit verdict, because the verdict is consulted first and only a
Nonefalls through to it. The comment at the branch names both populations so its remaining
reach is not read as enforced. Retiring it means classifying both populations at their
raise sites, which is a larger behaviour change than this fix.
Tests
test/test_cron_acp_retry.py. Revertingsrc/and re-running the file fails,naming the site, so the tests carry the fix rather than describe it.
Load-bearing:
test_acp_pipe_broken_triggers_retry— the realpipe brokenwording resets thesession and retries once. Returning rather than raising is also what keeps the run
off the auto-pause ladder:
CronService._executecallsrecord_failure()only inits
exceptarm, andrecord_success()zeroesconsecutive_failureswhen thecallback returns.
test_mid_prompt_death_is_not_retried_despite_legacy_wording— the typedmid-prompt death is refused even though its wording matches the legacy substring.
Asserts the stream is entered exactly once.
test_only_the_audited_sites_claim_resubmit_safety— exactly 1 + 1 + 0 sitesclaim resubmit-safety across
client.py,session_provider.py,session_handle.py. Pins the opt-in direction, because the in-flight set is notreliably enumerable and a new opt-in is what must justify itself.
test_resubmit_safe_states_the_verdict_without_exporting_the_hierarchy— thedefault is
None, so a death nobody classified carries no verdict rather than arefusal.
test_an_unclassified_death_keeps_the_retry_it_had_before_the_verdict_existed—raises
AcpProcessDied("process not running")with no keyword, byte-for-byte what_translate_deadbuilds, and asserts both that.resubmit_safe is Noneand that thesession is still reset and the turn retried. This is the test that fails under a
two-valued flag, which is how the earlier revision's regression was caught.
test_every_wording_matching_death_states_its_verdict_explicitly— walks the AST ofacp/client.pyand fails if anyAcpProcessDiedconstruction whose string literalscontain
"not running"or"process exited"omits theresubmit_safekeyword.Deleting the keyword at the mid-prompt site fails this test and nothing else, so the
one way a tri-state can silently grant a retry is mechanically closed.
test_resubmit_safe_death_retries_regardless_of_wording[something nobody predicted]— a wording sharing no substring with the legacy guard still retries,pinning the decision to the classification rather than to today's vocabulary.
test_pipe_broken_retries_only_once— the_acp_retriedmarker bounds the typedarm exactly as it bounds the substring arm.
test_a_fired_tool_withdraws_the_claim_before_it_reaches_the_caller— a deathraised after a tool fired in the same
stream_and_collectcall reaches the callerwith the claim withdrawn.
test_a_death_on_the_continuation_prompt_is_not_retried— the cron resume'scontinuation prompt dies claiming safety, and the callback is not replayed. Asserts
the stream is entered exactly twice.
Deleting either withdrawal fails exactly its own test, with the replay named in the
assertion message.
Controls. These pass on fixed and unfixed source alike, and each exists because
without it the fix could silently become a no-op or over-reach:
test_resubmit_safe_death_retries_regardless_of_wording[a wording that happens to say process exited]— a safe death retries because it is classified safe, notbecause its wording matched.
test_plain_acp_error_still_matches_the_legacy_wording_arm— the five plainAcpErrordeath sites are notAcpProcessDied, so scoping the arm to plain errorsleaves them matched. Without this the scoping could narrow the guard past the
defect it repairs. Its docstring records that this pins the arm's reach and does
not claim that reach is correct.
test_non_process_death_acp_error_still_not_retried— widening to the type did notwiden to every
AcpError.TestAcpProcessDiedRaiseSites(2 tests) — anchor the wording at the real_send_requestraise site and thetransient=Noneclassification, so a rewordingcannot quietly invalidate the reason this fix exists.
The pre-existing tests in the file are unchanged and still pass.
Manual verification
N/A — unit coverage sufficient. The tests drive the real
GatewayOrchestrator._cron_callbackand the realAcpClient._send_request(with areal
BrokenPipeError) rather than a stand-in, so the wording and the retrydecision are both measured rather than assumed.
The predicate is additionally measured directly against every death shape the code
raises, which is what the Before/After table above reports: of seven shapes, three
change and four answer as they did.
The per-site classification is pinned at source level because reaching those sites
needs a child that dies mid-turn. Two assertions run in opposite directions, and both
are needed:
resubmit_safe=True— the opt-ins are few and checkable, and a newopt-in is what must justify itself.
because with a
Nonedefault, silence at such a site is not a refusal but a retry.Neither assertion tries to enumerate the in-flight set. That set is not locally
checkable, and asserting it complete would restate the assumption the design exists to
avoid relying on.
Screenshots / video
N/A — no user-visible UI change. The diff touches the cron failure handler, the ACP
exception classification, and tests; no panel, component, layout or theme surface is
involved.
Related Issues
Fixes #7395
Pattern harvest
Rule candidate: review-prompt
Pattern: a retry or classification decision string-matches an exception message when
a typed exception carrying the same meaning is already in scope at the decision
site. The message is presentation; the type is the contract. This generalizes — the
same shape appears wherever recovery logic greps
str(exc)instead of testingisinstance, and each instance fails silently the first time somebody rewords amessage.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)