Skip to content

T3: ToolFailureCause factory for turn-path errors - #267

Merged
christopherkarani merged 10 commits into
mainfrom
arch/error-cause-factory
Oct 2, 2026
Merged

christopherkarani merged 10 commits into
mainfrom
arch/error-cause-factory

Conversation

@christopherkarani

@christopherkarani christopherkarani commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Spec: spec/spec-architecture-agent-turn-history-errors.md
Ticket: T3 (arch/error-cause-factory)

What changed (vs origin/main, 4 commits):

  • Add ToolFailureCause factory for turn-path error mapping
  • Route turn-path caught-error wraps and message-only failures through factory
  • review-fix: preserve batch cause, route ToolRegistry through factory
    Files: ToolFailureCause.swift (new), Agent+ToolLoop.swift, Agent+ToolLoopHandoffs.swift, EventStreamHooks.swift, ToolExecutionEngine.swift, ToolExecutionResult.swift, ToolRegistry.swift, + tests

Review passes done: branch self-review-fix commit included; no final verified review evidence available to PR agent, so opened as draft.

Intended behavior change (reviewed, pinned by tests)

stopOnToolError batch throw now nests the registry toolFailure as cause instead of dropping it (previously cause:nil). This fixes a dropped-cause bug; exact messages are pinned. Retryability unaffected (.toolFailure unconditionally non-retryable).

One cause->AgentError factory fed by per-adapter cause tables: FM string-fallback rows, OpenAI status rows, retryability URL-code set. Shared cancellation guard, retryAfter derivations (removing the FM resetDate duplication and the OpenAI header parser copy), and description matching. Behavior-identical; pinned by table-driven tests.
List in-scope turn-path call sites and out-of-scope origins (inference factory, tool-side synthesis, bridging, legacy executor, provider-owned loops, graph runtime). Document the deliberate absence of a CancellationError guard with a pinning test.
Pin exact stopOnToolError batch messages, multi-call first-failure-wins, and engine-throw vs recorded-transcript message equivalence.
@christopherkarani
christopherkarani marked this pull request as ready for review October 2, 2026 00:38
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@christopherkarani
christopherkarani merged commit 5c9686d into main Oct 2, 2026
3 of 6 checks passed
@christopherkarani
christopherkarani deleted the arch/error-cause-factory branch October 2, 2026 13:48
christopherkarani added a commit that referenced this pull request Oct 2, 2026
Brings in #265 (turn-step boundary API) and #267 (cause factories).
Conflict: docs/reference/api-catalog.md header counts — resolved via
scripts/ci/refresh-api-catalog-header.sh (266/273).
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