fix(acp): recover from kiro-style SessionResumeRequiredError in persistent session resume#93315
Conversation
…stent session resume Extend isRecoverableMissingManagerPersistentSessionError to also match 'Internal error' so that Kiro ACP threads can recover from stale persistent sessions instead of getting stuck with no text reply. Fixes openclaw#87830 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 12:37 PM ET / 16:37 UTC. Summary PR surface: Source +3, Tests +192. Total +195 across 2 files. Reproducibility: yes. at source level: the linked issue provides exact Kiro stale-resume logs, and current source shows the retry path depends on the manager matcher. I did not run a live Kiro backend in this read-only review. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Carry the structured resume-required signal into the manager retry predicate, cover both Do we have a high-confidence way to reproduce the issue? Yes at source level: the linked issue provides exact Kiro stale-resume logs, and current source shows the retry path depends on the manager matcher. I did not run a live Kiro backend in this read-only review. Is this the best way to solve the issue? No: the PR is a useful direction but not yet the best fix because it still relies on rendered text instead of the structured ACP Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fa9b8c8c6b9d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +3, Tests +192. Total +195 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Thanks for jumping on this. I agree with the P1 review that adding Concrete boundary I would suggest:
That should recover stale Kiro resumes without broadening unrelated ACP |
|
@yzhkali |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Hi @xialonglee — I worked the same issue (#87830) and wanted to flag a concern with the message-regex approach here, with evidence, in case it's helpful before this lands. The added alternative requires new SessionResumeRequiredError(
`Persistent ACP session ${params.record.acpSessionId} could not be resumed: ${params.reason}`,
{ cause: ... }
)So for the real Kiro failure the message is In the retry test here, the event message is An approach that avoids depending on the message wording is to key on acpx's structured |
|
Thanks @amersheeny for the thorough analysis — you are absolutely right. I verified the same code paths and confirmed that:
Closing this in favor of #93547. Thanks again for catching this before it landed. |
|
Closing in favor of #93547 which uses the structured |
Summary
isRecoverableMissingManagerPersistentSessionErroronly matchesresource not foundandno matching session, but Kiro emitsInternal error <- SessionResumeRequiredErrorinternal errortoSessionResumeRequiredError/SESSION_RESUME_REQUIREDin the error chain, preventing unrelated ACP-32603internal failures from triggering session identity clear + turn replayInternal errorwithout resume-required signal does NOT recoverVerification
pnpm test src/acp/control-plane/manager.turn-results.test.ts— 17 passed (1 KiroSessionResumeRequiredErrorregression test + 1 negativeInternal errorno-recovery test)pnpm check:changed— pendingReal behavior proof
Behavior addressed: Kiro ACP persistent session threads stuck with no text reply after backend invalidation because
Internal error <- SessionResumeRequiredErrorwas not recognized as recoverable.Real environment tested: Linux 4.19.112, Node 22.14, branch
fix/issue-87830-acp-session-resume-internal-errorat commit 8c9e518, no live Kiro backend.Exact steps or command run after this patch:
pnpm test src/acp/control-plane/manager.turn-results.test.tsEvidence after fix:
Observed result after fix: All 17 tests pass:
resource not found/no matching sessionrecovery tests continue to passInternal error <- SessionResumeRequiredErrortriggers fresh session retryInternal errorwithoutSessionResumeRequiredErrordoes NOT retry (negative proof)What was not tested: No live Kiro ACP backend was used; fix validated through the existing ACP mock-based test harness. The regression tests use the exact error format observed in production Kiro logs.