fix: resume eligibility requires output_tokens > 0 (#44 specimen 2/3)#57
Merged
Conversation
…esence PR #56's has-usage heuristic shows a resume button for codex sessions whose only turns billed input but produced zero output (hung WS turns, cross-session retries). Those sessions have no rollout file on disk, so `codex resume` fails — 4/19 real sessions were false positives against ~/.codex/sessions ground truth (issue #44, specimen 2/3). status and stopReason are unreliable discriminators (101 and 'completed' appear on failed turns); output_tokens > 0 separates all 19 sessions correctly. Tighten markSessionUsage to that condition. Refs #44 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
這個 PR 做了什麼 / 即將做什麼(視覺說明)1. 改了什麼 — 一行條件的修正2. 為什麼 — 三種 wire specimen,舊判別法在兩種上失效3. 資料流 — 改動點落在「單一漏斗」4. 架構上的變化 — 其實「沒有」結構變化5. 帶來的價值6. 即將做什麼 — PR-A 是 #44 三刀切的第一刀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PR #56's
has-usageheuristic still shows a resume button for codex sessions whose only turns billed input but produced zero output — hung WS turns (specimen 2) and cross-session retry shells (specimen 3) from #44. Codex never writes a rollout file for those, so the copiedcodex resume <sid>command fails withNo saved session found.Verified against
~/.codex/sessionsground truth: 4/19 codex sessions were false positives, including the originally reported019e929d-999e.Fix
markSessionUsagecondition:entry.usage→entry.usage?.output_tokens > 0.status(101 false positives) andstopReason(completedon failed turns) are unreliable;output_tokens > 0separates all 19 real sessions correctly per the analysis in #44.Tests
output_tokens > 0Smoke (isolated env, real traffic)
CCXRAY_HOME=/tmp/ccxray-smoke-44a ccxray --port 5604 --no-browser+ realcodex exec: successful turn (24 output tokens) →resumable: truewith correctcodex resumecommand.Refs #44 (this is the "resume button false positive" slice only; turn-list retry grouping remains open)
🤖 Generated with Claude Code