Skip to content

Keep usage from submitting Claude/CLI turns and delete CLI prompt files - #59

Merged
LikC1606 merged 1 commit into
mainfrom
fix/harness-usage-and-leaks
Nov 28, 2026
Merged

LikC1606 merged 1 commit into
mainfrom
fix/harness-usage-and-leaks

Conversation

@LikC1606

Copy link
Copy Markdown
Collaborator

The Claude Code and configured CLI adapters stopped the writer as soon as a valid completion file appeared. The native result that carries the turn's usage had not arrived yet, so every submitting turn was recorded as usage incomplete. Under a finite budget, incomplete usage blocks later dispatches.

  • After a valid handoff, the writer gets up to 10 s (the same cleanup deadline Codex uses) to finish. Claude stops as soon as its result frame arrives. The CLI's final JSON is now parsed after submission.
  • A validated handoff always resolves submitted. An interrupt or provider error during the grace period no longer turns it into failed, which matches Codex.
  • The CLI's per-turn prompt file under .scratch/cli-prompts is now deleted once the writer exits. Before, one copy per turn accumulated.

Tests: new fixture cases cover a result arriving after the completion file (Claude success and error; CLI jsonl and json) and prompt file removal. These tests fail on the old code. claudeCodeSession, cliSession, sealedHarness and workflowHarness: 109 passed, 2 skipped. tsc --noEmit and bun run build are clean. The two existing wait-for-completion-file tests now take about 10 s longer, so their timeouts are raised to 30 s.

🤖 Generated with Claude Code

The Claude Code and configured CLI adapters stopped the writer as soon as
a valid completion file appeared, before the native result carrying the
turn's usage arrived. Every submitting turn was recorded as usage
incomplete, which blocks later dispatches under a finite budget.
- After a valid handoff the writer now gets up to 10 s (Codex's cleanup
  deadline) to finish. Claude stops on its result frame; the CLI's final
  JSON is parsed after submission.
- A validated handoff always resolves 'submitted'; an interrupt or
  provider error during the grace no longer reads as a failure.
- The CLI's per-turn prompt file under .scratch/cli-prompts is removed
  once the writer has exited instead of accumulating one copy per turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LikC1606
LikC1606 merged commit 6432bd8 into main Nov 28, 2026
4 checks passed
@LikC1606
LikC1606 deleted the fix/harness-usage-and-leaks branch December 1, 2026 20:12
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.

1 participant