fix(session): avoid stalls when parent token probing hangs#101932
fix(session): avoid stalls when parent token probing hangs#101932LiLan0125 wants to merge 2 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 10:43 PM ET / 02:43 UTC. Summary PR surface: Source +88, Tests +122. Total +210 across 5 files. Reproducibility: yes. Source inspection on current main shows resolveParentForkDecision awaits resolveParentForkTokenCount without a timeout, and the PR body includes after-fix terminal proof for a never-resolving parent stat path. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land one canonical timeout fix that bounds parent sizing, preserves fresh and oversized behavior, and explicitly accepts fail-closed handling for unverified parent size. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows resolveParentForkDecision awaits resolveParentForkTokenCount without a timeout, and the PR body includes after-fix terminal proof for a never-resolving parent stat path. Is this the best way to solve the issue? Yes, with a policy caveat. The latest patch fixes the prior timeout-to-fork defect by making unresolved sizing skip inheritance, but maintainers still need to accept that fail-closed behavior versus preserving unknown-size transcript inheritance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6765eb0166fc. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +88, Tests +122. Total +210 across 5 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
Review history (6 earlier review cycles)
|
afe5e5c to
424cbc0
Compare
424cbc0 to
7b1f6a6
Compare
|
@clawsweeper re-review Fixed the P1 timeout-to-fork finding:
Verified:
Updated the PR proof with |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
A/B verified locally against base SHA. Ran vitest with the PR's test file against the PR's fix (B) and against the base's fix (A). Result: CLEAN A/B The new test |
Closes #101718
What Problem This Solves
Fixes an issue where users creating or forking a session from a parent could wait indefinitely when parent transcript token probing did not settle.
Why This Change Was Made
The parent fork decision now uses fresh persisted token counts immediately, and otherwise bounds transcript token probing to a short wait. If probing times out or cannot verify the parent size, OpenClaw starts the child with isolated context instead of continuing into parent transcript copy. Quickly resolved small parents still fork, and fresh or quickly resolved oversized parents still use the existing isolated-session skip behavior.
User Impact
Session creation and parent-fork workflows no longer stay blocked behind a stuck parent token probe or continue into another unbounded parent transcript read after the probe timeout. Users with oversized or unverified parent sessions get isolated context instead of inheriting unsafe parent history.
Impact Assessment
skipdecisions by avoiding transcript copy; timeout and unavailable-size probes now use that existing isolated-context path.Evidence
node scripts/run-vitest.mjs src/auto-reply/reply/session-fork.test.tspnpm tsgo:prodpnpm check:test-typesReal behavior proof
Behavior addressed: Parent fork caller paths return instead of waiting indefinitely when parent token probing does not settle, and the timeout path avoids the later parent transcript copy.
Environment tested: Linux, Node v22.22.0, local source checkout on branch
fix/101718-session-fork-token-timeout, isolated temporaryOPENCLAW_HOMEandOPENCLAW_STATE_DIR.Steps run after the patch: Called the patched
forkSessionEntryFromParentproduction caller path with a parent transcript whose token-probefs.promises.statnever resolves, then verified fresh oversized parent tokens still produce the existing skip decision.Evidence after fix:
Observed result after the fix: The stalled parent token-probe caller path returned
skippedwithparent-size-timeoutafter roughly one second, kept the originalparent.jsonl, and created zero fork transcripts. Fresh oversized tokens still returnedparent-too-large.Not tested: A live gateway session creation with a real remote filesystem or transcript handle blocked indefinitely was not exercised locally.