Skip to content

[sentry:7848997515] The TUI's agent:<id> action refused an empty model list by throwing a plain Error('Load a text model in Models before opening an agent.') from src/tui/workspace/serve - #102

Merged
Ooooze merged 2 commits into
mainfrom
codex/sentry-fix/7848997515
Nov 18, 2026
Merged

Ooooze merged 2 commits into
mainfrom
codex/sentry-fix/7848997515

Conversation

@Ooooze

@Ooooze Ooooze commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

The TUI's agent:<id> action refused an empty model list by throwing a plain Error('Load a text model in Models before opening an agent.') from src/tui/workspace/server/agent-actions.ts:26. That refusal is a user-facing precondition, but the action boundary in WorkspaceApp reports every escaped exception through captureFailure(... { component: 'tui', operation: 'workspace.action' }), and expectedFailure in src/telemetry/failures.ts is false for an untagged Error, so the deliberate refusal arrived in Sentry as an unexpected failure with no error_code (matching the event's failure_reason: unknown, failure_category: unknown). Fix: the guard is kept, but the empty list now writes the existing message into workspace state and returns a handled action inside the same try/finally, so busy still clears and the user still sees the text — the same shape as the two sibling preconditions above it and as ADR 2026-11-02-keep-managed-model-refusals-local prescribes. Lookup failures still propagate: listChatModels throws on non-ok responses, and the control test asserts that rejection is still reported. Only src/tui/workspace/server/agent-actions.ts changed; the probe src/tui/workspace/server/agent-actions.test.ts (already carried from diagnosis) passes after the patch — 2/2 tests in the isolated check.

Evidence:
Event release atc@0.2.18#b869424b124d resolves to base sha b869424 with an empty release_diff, so the recorded frames are current-base lines.
Event frame src/tui/workspace/actions.ts:62:13 is the if (await agentAction(id, ctx)) return call inside activate; frame src/tui/workspace/server/agent-actions.ts:26:37 was the single throw statement on that line.
src/tui/workspace/server/agent-actions.ts:11-22 already handles the setup and daemon/API preconditions by patch({ message }) plus return true, so an exception for the empty model list was inconsistent with its own neighbours.
src/telemetry/failures.ts expectedFailure returns false for a plain Error (no AtcError, no AtomicCoreError, no cancellation, no reported marker), so the refusal was reported as unexpected with error_code derived from an absent code.
src/terminal-service/client.ts listChatModels returns [] only for a successful response with no model ids and throws on non-ok responses, so the empty-list branch cannot mask an HTTP or credential failure.
docs/decisions/2026-11-02-keep-managed-model-refusals-local.md records the same class of defect and the same remedy for the managed-model refusal.
Isolated check after the patch: src/tui/workspace/server/agent-actions.test.ts, 2 passed / 0 failed — 'refuses to open an agent when no model is loaded without throwing' and 'keeps a failed model lookup reported instead of turning it into a refusal'. On the base the first failed with promise rejected "Error: Load a text model in Models before…" instead of resolving, while the control test passed, isolating the refusal path.

Regression tests: src/tui/workspace/server/agent-actions.test.ts

Full CI and human review are required.

Report: http://127.0.0.1:8080/tenants/707d0855-80ab-4e1f-a156-f1c4546cbf52/runs/a89dc7c0-479c-4a4c-8f5d-be26cc7f17f0

Sentry: https://atomic-chat.sentry.io/issues/7848997515/

@Ooooze
Ooooze merged commit 379570e into main Nov 18, 2026
9 checks passed
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