Skip to content

fix(native-chat): say which request a chat start ran out of time on, and log the original error - #30992

Merged
nwparker merged 2 commits into
mainfrom
nwparker/chat-start-failure-diagnostics
Oct 20, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/chat-start-failure-diagnostics

Conversation

@nwparker

@nwparker nwparker commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​148 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​144
Prod 21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​187 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​166

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/start got 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 only startFailed, and nothing logged the original error, so there was no way to tell why it failed.

After: The same failure reads:

Codex took too long to start (no response to thread/start after 30s). Send your message to try again. If this keeps happening, the computer running this chat may be overloaded.

(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-failed entry 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 through cause and aggregated-error chains. The Codex connection's per-request deadline now marks its CodexAppServerTimeoutError. The timeout value is unchanged.
  • providerStartupFailureFact copies that onto the startFailed fact as a new optional requestTimeout field. A provider exit Orca actually saw still takes priority.
  • The shared failure words read requestTimeout and build the sentence from two new copy pieces, translated on desktop in all six locales.
  • failStartingChild logs through the existing structured-session logger for the current child only; a superseded or closed child does not log. openStructuredAgentSessionProviderChild passes 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 whose thread/start times 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: the log entry and the fact carry only the protocol method name, which is checked against a strict pattern before it is shown, and a number. No params, prompts, or credentials.
  • SSH/remote: the host writes the sentence and the fact. The wording says "the computer running this chat" because the stalled machine may be the remote one.
  • Mobile: it reads the host's sentence, so it gets the new wording too.
  • Cross-platform: no platform-specific code.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…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
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Provider request timeout errors now carry method and duration metadata. Startup failure handling preserves that metadata in structured failure facts and logs elapsed provider-open time. The renderer displays localized startup timeout and possible file-watching messages. Tests cover metadata validation, startup failure behavior, and French message rendering.

Priority: ⚪ Pending latest changes

Merge Risk: 🟡 Moderate · up to d7f1c

Startup timeouts now produce clearer chat messages, but the new failure log records raw provider error text, which can include stderr or response content, in traces and console output without redaction. Redact and cap that diagnostic before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 18 files. (7 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: native-chat startup timeout messages now identify the request that timed out and preserve the original error for logging.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description is complete and follows the repository template. It explains the user-visible behavior, implementation, rationale, compatibility, testing, visual proof, security, cross-pl…
Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the user-visible behavior, implementation, rationale, compatibility, testing, visual proof, security, cross-platform impact, and checklist status. Manual testing was explicitly left unchecked, and the automated validation performed is documented.

Full details: Docstring Coverage

Explanation

Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 18 files. (7 skipped: 7 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4c83d7a3-b66f-4e07-9620-22cc2427e72d
📥 Commits

Reviewing files that changed from the base of the PR and between 4b6fd92 and d7f1c5a.

📒 Files selected for processing: 25
  • src/main/codex/codex-app-server-connection.test.ts
  • src/main/codex/codex-app-server-connection.ts
  • src/main/codex/codex-scripted-child.test-fixture.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-conversation-lifetime.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-recovery.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-failure-text.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-failure-text.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-provider-open.ts
  • src/main/provider-process/provider-request-timeout.ts
  • src/main/runtime/structured-agent-session-codex-start-deadline.test.ts
  • src/renderer/src/components/native-chat/agent-session-failure-words-text.test.ts
  • src/renderer/src/components/native-chat/agent-session-failure-words-text.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/agent-session-failure-copy.ts
  • src/shared/agent-session-failure-fact-schema.ts
  • src/shared/agent-session-failure-words.ts
  • src/shared/agent-session-failure.test.ts
  • src/shared/agent-session-failure.ts
  • src/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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 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

@nwparker
nwparker merged commit c09af97 into main Oct 20, 2026
37 checks passed
nwparker added a commit that referenced this pull request Oct 20, 2026
…rt stacks (#31216)

Fixes bugs found reviewing #30270, #30605, #30885, #30417, #31113, #30415,
#30992 and #30997, and removes code those PRs made unnecessary.

Co-authored-by: Claude <[email protected]>
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