Surface missing credential run failures#1915
Conversation
Visual recap — generation failedThe visual recap could not be generated for this pull request. This is informational only and does not block the PR. Diagnostic: No plan URL: create-visual-recap failed 422 Unprocessable Entity: {"error":"Could not parse expression with acorn"} Agent output: create-visual-recap failed 422 Unprocessable Entity: {"error":"Could not parse expression with acorn"} |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…1-run-status # Conflicts: # packages/core/src/client/agent-chat-adapter.spec.ts
…1-run-status # Conflicts: # packages/core/src/agent/production-agent.chain-continuation.spec.ts
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Builder reviewed your changes and found 1 potential issue 🟡
Review Details
This incremental update broadens the original run-failure fix across run-manager, run-store, production-agent, and the shared client adapter. The new head correctly addresses the previously open concerns I rechecked: background terminal recovery now clears chunk-scoped recoverable error state when the followed run id changes, and run reconciliation bounds its terminal-event scan with an explicit limit while still preserving the intended precedence of real failures over later success markers. I resolved those stale review threads.
Risk assessment: standard. The code touches shared run lifecycle, background continuation handoff, and chat recovery paths that are reused across surfaces, so mistakes here can silently misclassify failed runs.
Key finding:
- 🟡
startRun()still invokesonCompletebefore normalizing a pending terminalerror/missing_api_keyevent into the final errored status. Downstream consumers inproduction-agenttherefore still see these runs as completed during completion handling, which can incorrectly mark tracked progress as succeeded and skip worker error diagnostics.
The overall direction remains sound, and the added regression coverage around missing credentials, error:* terminal reasons, and continuation chunk terminalization is strong.
🧪 Browser testing: Will run after this review (PR touches UI/client chat behavior)
Summary
missing_api_keyterminal events as errored in run reconciliation and direct run finalizationterminal_reason=missing_api_keyas actionable missing-credential chat failureserror:missing_credentialsrecovery and fail any completed row carrying an expliciterror:*reason@agent-native/coreVerification
node_modules/.bin/oxfmt --check packages/core/src/agent/run-manager.ts packages/core/src/agent/run-manager.spec.ts packages/core/src/agent/run-store.ts packages/core/src/agent/run-store.spec.ts packages/core/src/client/agent-chat-adapter.ts packages/core/src/client/agent-chat-adapter.spec.tscd packages/core && node_modules/.bin/vitest --run src/agent/production-agent.spec.ts src/agent/production-agent.chain-continuation.spec.ts src/agent/run-manager.spec.ts src/agent/run-store.spec.ts src/client/agent-chat-adapter.spec.ts src/agent/run-loop-with-resume.spec.ts src/agent/run-store.durable-background.spec.ts(450 tests)cd packages/core && pnpm typecheckgit diff --check.task-sweep/logs/claude-opus-plan-20260706-134914.log,.task-sweep/logs/claude-opus-plan-output-20260706-134914.jsonl.task-sweep/logs/claude-opus-final-review-20260706-180931.log,.task-sweep/logs/claude-opus-final-review-output-20260706-180931.jsonl.task-sweep/logs/claude-fable-5-refresh-plan-retry-20260709-212943.debug.log,.task-sweep/logs/claude-fable-5-refresh-plan-retry-output-20260709-212943.jsonl.task-sweep/logs/claude-fable-5-refresh-review-20260709-214244.debug.log,.task-sweep/logs/claude-fable-5-refresh-review-output-20260709-214244.jsonl(no blockers; approved)Manual story
As a hosted Analytics user without the required model credential, asking the agent a question now lands in a clear missing-credential failure state instead of a completed/successful run. Mid-stream errors and missing-key terminal events persist as failed run rows with error fields, while ordinary successful runs still complete.
Notes
mainwhile preserving its reconnect, stale-run, and continuation behavior.