Skip to content

docs(tools): record tool-failure audit and plan T15–T17 - #265

Merged
lg2m merged 1 commit into
mainfrom
docs/eng-1012-tool-failure-audit
Oct 8, 2026
Merged

lg2m merged 1 commit into
mainfrom
docs/eng-1012-tool-failure-audit

Conversation

@lg2m

@lg2m lg2m commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Closes ENG-1012 (docs half; T15–T17 are follow-up slices).

What

An audit of the local session store (~/.local/share/qq/sessions.sqlite3, store schema 42) explains why search, read_file, and edit_file show so many errors. It is recorded as docs/plans/tool-layer.md § D9, with raw counts in the tool-layer ledger. No code changes.

Findings

  • Lifetime: 30,326 tool calls, 3,654 errors (12 %). The largest historic class, 1,637 search cursor_invalid (939 of them in one runaway run), is already fixed on main by T2.1 (ENG-959).
  • Since 2026-09-26: 9,940 calls, 926 errors (9.3 %). By tool: read_file 12.2 %, search 5.6 %, edit_file 26.8 %, read_tool_result 33 %. The goal is < 1 %.
  • Causes of the 753 read/edit errors in that window:
    • 252: ranges sent together with offset/limit. Codex-family models fill every optional field.
    • 234: empty {} arguments. These came in whole parallel batches, on Codex routes only. This looks like a Responses adapter gap: openai.rs only accumulates function_call_arguments.delta and ignores the full arguments on the *.done events. That is unconfirmed until a stream is captured.
    • 63: edit_file with "" for the forms it does not use.
    • Smaller classes: context > 5, empty globs, empty spill query.
    • Real outcomes: path_not_found and range_out_of_bounds are genuine answers and should stay visible to the model.
  • Retries rarely fix it: after a contract error, the next call to the same tool failed again 434 times and succeeded 127 times.
  • The TUI does not grade errors: it renders every is_error as a red ✕ with an error panel, so a self-corrected argument looks the same as a real failure.

Planned slices

  • T15: read default-shaped arguments as absent, with a note= in the header. This is semantic defaulting; RR10 (ENG-872) keeps type coercion.
  • T16: take Responses tool arguments from the *.done events when no deltas arrived. Capture a stream first.
  • T17: add ToolErrorKind { Correction, Outcome, Failure } with an additive protocol field. The TUI shows ↻ (muted) / ! (warning) / ✕ (failure), and folds a correction into the successful retry that follows it.

Verification

Docs only. The counts come from read-only sqlite3 queries over tool_calls joined to runs.resolved_model_json; the method is in the ledger entry. No build, protocol, or performance impact.

Session-store audit (plan § D9): read-side contract errors are mostly
default-shaped arguments from Codex-family models, empty {} batches on
Responses routes, and a single is_error bit the TUI renders as a red
failure. Opens T15 (default-shaped arguments), T16 (Responses done-event
arguments), and T17 (ToolErrorKind severity in clients).

Refs: ENG-1012
@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.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@lg2m
lg2m added this pull request to stack #268 October 7, 2026 04:38
@lg2m
lg2m merged commit 87c81cd into main Oct 8, 2026
4 checks passed
@lg2m
lg2m deleted the docs/eng-1012-tool-failure-audit branch October 8, 2026 11:03
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