Skip to content

ci: make codex stream duration test race-stable#5

Draft
easel wants to merge 2 commits into
masterfrom
worktree-agent-fizeau-df282732
Draft

ci: make codex stream duration test race-stable#5
easel wants to merge 2 commits into
masterfrom
worktree-agent-fizeau-df282732

Conversation

@easel
Copy link
Copy Markdown
Owner

@easel easel commented May 15, 2026

Summary

  • make the codex stream duration assertion tolerant of wall-clock truncation under race instrumentation
  • keep the test tied to the emitted tool_result by asserting the expected tool result ID and a positive lower bound

Verification

  • CGO_ENABLED=1 go test -race ./internal/harnesses/codex -run TestParseCodexStream_CommandExecutionDuration -count=20
  • make test-race

Refs fizeau-df282732

easel pushed a commit that referenced this pull request May 28, 2026
…u-e46a791a]

Implement QuotaStatus, RefreshQuota, QuotaFreshness, SupportedLimitIDs,
AccountStatus, RefreshAccount, and AccountFreshness on claudetui.Harness.

CONTRACT-004 specifies both claude and claude-tui share the same durable cache
under the single-account assumption. Per ADR-013, QuotaStatus reads the
anthropic-package-owned snapshot mirror; RefreshQuota delegates the /usage PTY
probe through the ptyquota.Run machinery in the anthropic/ neutral package.
Both harnesses use single-flight to coalesce concurrent refresh calls.

Extract shared quota parsing logic (parseClaudeUsageOutput) to the anthropic
neutral package so both claude and claude-tui can use the same parser without
cross-harness imports (CONTRACT-004 invariant #5).

Acceptance Criteria:
- AC#1: QuotaStatus returns same data as claude given same cache state ✓
- AC#2: SupportedLimitIDs returns same set as claude ✓
- AC#3: RefreshQuota performs /usage PTY probe via shared machinery ✓
- AC#4: Concurrent refresh calls coalesce via single-flight ✓
- AC#6: QuotaFreshness returns 15 minutes default per ADR-013 ✓
- All tests pass: go test ./internal/harnesses/claude-tui/... -count=1 ✓

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
easel pushed a commit that referenced this pull request May 28, 2026
… [fizeau-5cfc7178]

Implements ADR-013 constraints #4, #5, #6 for claude-tui harness:

1. Empirical /clear semantics verification
   - Created doc: docs/helix/02-design/empirical-clear-semantics-verification.md
   - Verified /clear command exists and session remains alive
   - Documented expected semantics for model/permission persistence

2. Pooled session implementation
   - Package-scope singleton pool keyed by (harness, workdir)
   - Depth-1 default, expandable via SetPoolDepth() for service-mode concurrency
   - Concurrent-claim serialization via mutex per session
   - Between-turn /clear resets conversation history without losing session

3. Pool eviction on /clear failure
   - Failed /clear evicts session and creates fresh one
   - runTurn() handles /clear errors with eviction + fallback

4. Orphan reaper integration
   - reapOrphanSessions() startup helper (can be expanded to OS-specific process tree traversal)
   - Pool provides primary eviction safety mechanism

5. Tests covering all acceptance criteria
   - TestEmpiricalClearCommand: verifies /clear exists and works
   - TestPoolConcurrentClaimSafety: concurrent claims serialize correctly
   - TestPoolEvictionOnFailure: pool eviction on session failure
   - TestPoolDepthConfiguration: service-mode concurrency with depth>1
   - TestPoolSessionReuseLatency: reuse is faster than fresh creation
   - TestPoolRaceCondition: no data races in concurrent claims
   - TestClaudeTuiOrphanReaper: orphan reaper integration

All tests pass: go test ./internal/harnesses/claude-tui -count=1

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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