Repository navigation
fix(native-chat): say which request a chat start ran out of time on, and log the original error - #30992
Conversation
…nd log the original start error A start that failed because a provider request hit Orca's deadline (e.g. Codex thread/start after 30s) now says so instead of the generic couldn't-start banner. The deadline marks its error with the method and timeout; the start failure fact carries them as an optional requestTimeout field, and the host logs the original error, method and elapsed open time.
… child's failure, without timing in the repeat key
📝 Walkthrough
Priority: ⚪ Pending latest changes Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4c83d7a3-b66f-4e07-9620-22cc2427e72d
📒 Files selected for processing: 25
src/main/codex/codex-app-server-connection.test.tssrc/main/codex/codex-app-server-connection.tssrc/main/codex/codex-scripted-child.test-fixture.tssrc/main/native-chat/agent-session-wire/structured-agent-session-conversation-lifetime.tssrc/main/native-chat/agent-session-wire/structured-agent-session-event-recovery.tssrc/main/native-chat/agent-session-wire/structured-agent-session-failure-text.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-failure-text.tssrc/main/native-chat/agent-session-wire/structured-agent-session-provider-open.tssrc/main/provider-process/provider-request-timeout.tssrc/main/runtime/structured-agent-session-codex-start-deadline.test.tssrc/renderer/src/components/native-chat/agent-session-failure-words-text.test.tssrc/renderer/src/components/native-chat/agent-session-failure-words-text.tssrc/renderer/src/i18n/en-runtime-required.jsonsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/agent-session-failure-copy.tssrc/shared/agent-session-failure-fact-schema.tssrc/shared/agent-session-failure-words.tssrc/shared/agent-session-failure.test.tssrc/shared/agent-session-failure.tssrc/shared/agent-session-request-timeout.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
| failure: failure.kind, | ||
| ...failure.requestTimeout, | ||
| ...(openMs === undefined ? {} : { openMs }), | ||
| error |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Redact the startup error before logging it.
If a provider error contains a token, file content, or personal data, this new error field sends that data to tracing and console.warn. Log a length-capped, redacted diagnostic instead. Keep the error class and safe request metadata.
Based on learnings, raw startup or provider errors can disclose sensitive data in logs and must be redacted and length-capped.
Source: Learnings
ELI5
When a chat agent took too long to answer one of its startup questions, Orca gave up and showed "couldn't start, send your message to try again" — and threw away the reason. Now the chat says which step stalled and for how long, and the original error is written to the log.
What Changed
Before: A Codex chat whose
thread/startgot no answer within Orca's 30-second request deadline (in the reported case, because the system's file-event service was overloaded) showed the generic "Codex couldn't start. Send your message to try again." The journal kept onlystartFailed, and nothing logged the original error, so there was no way to tell why it failed.After: The same failure reads:
(Without "Send your message to try again." where the banner has its own Retry control. It names no specific cause, because MCP startup, the network or config can also stall a start.) The main log gets one
agentSession.provider-open-failedentry with the error's class and message, the failure kind, the request method, its deadline, and how long the open ran. Prompts and request params are never logged.Mechanism:
provider-process/provider-request-timeout.ts(provider-generic) marks an error with{ method, timeoutMs }where a request deadline fires and reads it back throughcauseand aggregated-error chains. The Codex connection's per-request deadline now marks itsCodexAppServerTimeoutError. The timeout value is unchanged.providerStartupFailureFactcopies that onto thestartFailedfact as a new optionalrequestTimeoutfield. A provider exit Orca actually saw still takes priority.requestTimeoutand build the sentence from two new copy pieces, translated on desktop in all six locales.failStartingChildlogs through the existing structured-session logger for the current child only; a superseded or closed child does not log.openStructuredAgentSessionProviderChildpasses in the elapsed open time. The logger writes that timing but leaves it out of its repeat-suppression key, so repeated identical failures are still grouped.Why
The cause comes from a typed property set where the deadline fires, not from parsing "exceeded 30000ms" out of a message. That fits how this code already carries provider diagnostics and argument problems. It also stays provider-generic: any adapter whose request deadline marks its error gets the same words.
Compatibility with older versions: the field is optional and the journal schema admits it loosely. An older client that finds a field it doesn't know already falls back to the host's own sentence, and the host now writes the specific one. So mixed-version and SSH setups show the right words without any protocol change.
Alternatives considered: adding a new failure kind would have needed new handling everywhere a kind is matched, and older clients would show it as unknown. Changing the timeout was explicitly out of scope.
Linked Issue
N/A (internal report)
Visual Proof
N/A: no layout or component change. The existing notice row and banner now show a different sentence for this case. The exact text is asserted in tests (host journal row, rejected message, and French translation).
Testing
src/main/runtime/structured-agent-session-codex-start-deadline.test.ts: a scripted Codex whosethread/starttimes out after 30s. The test asserts the rejected message's fact and sentence, the single status row, that the child is stopped, and the log entry (method, deadline, open time of 30s or more, error class).codex-app-server-connection.test.ts: the real connection's deadline marks its error with the method and timeout.structured-agent-session-failure-text.test.ts: the marker survives a wrapping error, the Retry-control wording, and that an observed exit still wins.agent-session-failure.test.ts: the field survives schema admission, and a malformed or unsafe value is dropped so the host's sentence is used instead.agent-session-failure-words-text.test.ts: the translated sentence.Ran: the targeted tests, oxlint,
pnpm run check:code-quality:changed,pnpm tc:node,pnpm tc:web, and the localization catalog, extraction, and coverage checks.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)