NEW_SESSION_TIMEOUT_MS was increased from 30s to 120s in #3819, but the
session-switch guard test still ticked only 30s. The test hung, leaked
mock.timers state, and caused 7 downstream tests to hang — timing out
the entire CI build job.
showInterviewRound now accepts an AbortSignal via opts.signal. When the
remote channel wins the race, controller.abort() closes the local TUI
modal instead of leaving an orphaned interactive prompt capturing input.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
NEW_SESSION_TIMEOUT_MS was 30s which fired before agent_end on slow-starting
tasks, causing spurious stopAuto hard stops. Increased to 120s and added a
dedicated timeout branch in runUnitPhase that calls pauseAuto (recoverable)
instead of stopAuto (destructive teardown).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Validates the race routing logic: raceRemoteAndLocal helper exists,
routing checks both hasRemote and ctx.hasUI, remote timeouts are
treated as non-wins, AbortController cancels the loser, and
isRemoteConfigured is exported from manager.ts.
When a remote channel (Discord/Slack/Telegram) is configured, ask_user_questions
now races the local TUI against the remote dispatch. The first response wins and
the loser is cancelled. Previously, remote completely preempted the local TUI,
meaning terminal users never saw the question prompt when remote was configured.
Closes#3801
When ask_user_questions fails, errors, or is cancelled during a
discussion flow, the model is now mechanically blocked from all
non-read-only tool calls until it re-asks and gets a valid response.
Previously, gate enforcement was prompt-only — the model could
rationalize past failed ask_user_questions calls ("auth issue, I'll
continue") and generate an entire plan without any user interaction.
The pending gate mechanism:
- tool_call hook: any ask_user_questions during discussion sets pending
- tool_result hook: valid user response clears pending; failure keeps it
- tool_call hook: blocks write/edit/gsd/mutating-bash while pending
- read-only tools and ask_user_questions itself always allowed
Two bugs prevented subscription users from routing through Claude Code CLI:
1. Retry handler regex only matched "third-party" errors but actual error is
"You're out of extra usage" — fallback never triggered
2. auto-model-selection actively rerouted bare model IDs back to anthropic
even after startup migration set claude-code as the session provider
Anthropic now blocks third-party apps from using Pro/Max subscription
quotas via direct API calls. This change makes the claude-code provider
(which delegates to the local claude CLI binary) the default path for
Anthropic subscription users — TOS-compliant because requests flow
through Anthropic's own infrastructure.
Changes:
- Enhanced readiness check to verify CLI auth status (not just binary)
- Startup migration: auto-switch anthropic → claude-code when CLI ready
- Error recovery: auto-switch on third-party 400 block error
- Onboarding: removed Anthropic from OAuth, added Claude CLI option
- Added claude-code to flat-rate providers (no dynamic routing benefit)
Closes#3772