fix(review): add a stalled-no-output fast-fail deadline for claude-code - #5013
Conversation
claude-code never got the same firstOutputTimeoutMs/stalledNoOutput fast-fail mechanism codex already has (added for the original GITTENSORY-K/M dead-air hang) -- deliberately, on the belief at the time that claude-code had no comparable prod-observed hang. That premise is now stale: subscription_cli_timeout for provider=claude-code accumulated 4,030+ events over 12 days, ongoing. Mirror codex's proven pattern: a separate, shorter deadline (default 30s, independently configurable via CLAUDE_AI_FIRST_OUTPUT_TIMEOUT_MS) that only fires when stdout has produced zero bytes, distinct from a genuine full-timeout. Closes #4994
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 7cacbaa | Commit Preview URL Branch Preview URL |
Jul 11 2026, 08:49 AM |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5013 +/- ##
==========================================
- Coverage 94.36% 94.35% -0.01%
==========================================
Files 457 457
Lines 39210 39216 +6
Branches 14298 14300 +2
==========================================
+ Hits 37001 37004 +3
Misses 1558 1558
- Partials 651 654 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-11 08:53:30 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 2 non-blocking
Review context
Contributor next steps
Signal definitions
Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|


Summary
claude-codesubscription-CLI hangs and times out repeatedly (4,030+ combined Sentry events across GITTENSORY-K/M/8/Z, 12 days ongoing).codexalready has afirstOutputTimeoutMs/stalledNoOutputfast-fail mechanism (added earlier specifically to fix the original GITTENSORY-K/M dead-air hang for that provider), butclaude-codewas deliberately left unwired — the code's own comment stated "Claude Code has no comparable prod-observed dead-air hang" at the time. That premise is now stale, confirmed by the ongoing event volume.resolveClaudeFirstOutputTimeoutMs(new, defaults to 30s, independently configurable viaCLAUDE_AI_FIRST_OUTPUT_TIMEOUT_MS, clamped below the full timeout), threaded intocreateClaudeCodeAi's spawn call, with a distinctclaude_stalled_no_outputerror so this fast-fail path is separately observable in Sentry/logs from a genuine full-timeout.CODEX_AI_FIRST_OUTPUT_TIMEOUT_MSdeclaration toenv.d.ts(existed in code, was never documented there) while touching the adjacent lines.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #4994).Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocallynpm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:check(N/A, but rannpm run selfhost:env-referencesince this addsenv.*reads undersrc/selfhost/**— regenerated and committed)npm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderate(unchanged from last full run this session — no dependency changes)If any required check was skipped, explain why:
test:coverage(full unsharded): not run end-to-end — ran scopedvitest --coveragefortest/unit/selfhost-ai.test.ts(the only file touching this code) and confirmed via lcov that every changed line/branch is covered; the only zero-hit lines in that file are pre-existing, untouched by this diff. Also ran the full file (149 tests, all passing) after rebase.test:workers/build:mcp/test:mcp-pack/ui:lint/ui:typecheck/ui:build: not run — this change touches onlysrc/selfhost/ai.ts,src/env.d.ts, and the generated env-reference doc; no Worker-pool, MCP, or UI-component surface changed.Safety
UI Evidencesection. (N/A.)Notes
Part of a batch of 13 bug fixes filed from a Sentry-issue triage this session (#4994–#5006). This is #1 by impact (highest event volume, still ongoing).