Skip to content

feat(tui): grade tool errors as corrections, outcomes, or failures (T17) - #272

Merged
lg2m merged 10 commits into
fix/eng-1012-t15-tolerant-defaultsfrom
feat/eng-1012-t17-tool-error-kind
Oct 8, 2026
Merged

lg2m merged 10 commits into
fix/eng-1012-t15-tolerant-defaultsfrom
feat/eng-1012-t17-tool-error-kind

Conversation

@lg2m

@lg2m lg2m commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #267 (T15; base fix/eng-1012-t15-tolerant-defaults). Implements T17 from docs/plans/tool-layer.md § D9.

Closes ENG-1014 · part of ENG-1012

User-visible behavior

Every is_error tool result used to render as a red ✕ with an error panel, so a model fixing its own argument looked like a crash. Error rows are now graded:

Kind Example codes Row Under it
Correction invalid_*, bad_glob, cursor_invalid, not executed:, not_read: muted ↻ … corrected nothing (text on expand)
Outcome path_not_found, stale_file, not_found, range_out_of_bounds, non-zero shell/exec exit warning ! … <code> one row of the error tail
Failure anything else, including any unlisted code ✕ as today the error panel, as today

A correction followed later in the block by a successful call to the same tool folds into that retry: the retry's row is the record. The transcript cursor and expand still reach it, and a block of retried reads still folds to one ▸ Read ×N summary.

Design notes

  • No wire field. This is a change from the plan. Every tool error already leads with a stable code:, so qq_protocol::ToolErrorKind::of(name, result) and ToolCallSnapshot::error_kind() classify on read. Stored history and older servers therefore grade the same way, with no store migration and no PROTOCOL_VERSION bump. ToolCallSnapshot is deny_unknown_fields, so even an optional field would have forced a bump. The plan has been updated to match.
  • Unknown codes default to Failure, so nothing becomes quieter by accident.
  • The model-facing text and the persisted result are unchanged.

Verification

  • cargo fmt --all -- --check; workspace cargo clippy --all-targets --all-features -- -D warnings
  • cargo test -p qq-protocol -p qq-tui: new tool_error_kinds_follow_the_leading_error_code and error_rows_grade_by_kind_and_corrections_fold_into_their_retry. All 332 TUI lib tests and the goldens pass; the failure-row tests are unchanged.
  • Render bench, base vs branch back to back (two rounds): tool_calls_32_rows 23.9/24.8 vs 24.4/25.3 µs, folded 12.3/12.9 vs 12.4/12.3 µs, expanded 53.4/55.6 vs 54.1/53.8 µs. This is noise. Blocks without an error skip the filter allocation.

Compatibility / performance

Rendering only. No protocol, store, or model-text change.

Review repairs (c50df4b)

  • Inherits repaired T15 base without rewriting history.
  • Only reserved QQ built-in names are eligible for correction/outcome classification; MCP/embedded external errors remain Failure. Plain invalid credentials and malformed batch indices remain failures.
  • Correction details follow inline vs inspector placement; batch edits and command exits display their actual code/exit label. Focused regressions and unchanged goldens pass.
  • Workspace fmt, all-target/all-feature Clippy, full tests and build pass. Earlier headless timeout recorded honestly; final rerun passes.
  • 30 A/B + A/A render pairs: median row/folded/expanded/inspector changes all <5%; pressured-host caveat and raw evidence path in ledger. Independent review found an empty-index case, now fixed/tested; final independent stack review approves.

Every is_error result rendered as a red ✕ with an error panel, so a model
correcting its own argument looked like a crash (tool-layer D9).

qq-protocol gains ToolErrorKind, classified from the result's leading
error code (ToolErrorKind::of / ToolCallSnapshot::error_kind). There is no
wire field: stored rows and older servers grade the same, with no store
migration or protocol bump. Unlisted codes stay Failure.

The TUI renders a Correction as a muted ↻ 'corrected' with no panel, an
Outcome as a warning ! with its code and one row of tail, and a Failure
as before. A correction followed by a successful call to the same tool
folds into the retry; selecting or expanding still shows it.

Refs ENG-1012
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T11:01:19.813936Z d92ee7c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 117f8f94d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-tui/src/view/tools.rs Resolved
Comment thread crates/qq-tui/src/view/tools.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
@lg2m
lg2m added this pull request to stack #268 October 7, 2026 19:30
lg2m added 2 commits October 7, 2026 23:39
# Conflicts:
#	docs/plans/progress/tool-layer.md
T17 / ENG-1014. Gate severity by reserved built-in names, retain malformed codes as failures, and normalize batch/exit labels. Add regressions and record render measurements plus workspace gates.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c50df4b2e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-protocol/src/sessions.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 966d93a54a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-tui/src/view/tools.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c8cb0675c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-tui/src/view/tools.rs Resolved
Comment thread crates/qq-tui/src/view/tools.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3207f528d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-tui/src/view/tools.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-tui/src/view/tools.rs Resolved
Comment thread crates/qq-tui/src/view/tools.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c10c44705

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread crates/qq-tui/src/view/tools.rs Resolved
Comment thread crates/qq-tui/src/view/tools.rs Resolved
@lg2m
lg2m merged commit 6d46e25 into main Oct 8, 2026
4 checks passed
@lg2m
lg2m deleted the feat/eng-1012-t17-tool-error-kind 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