Skip to content

fix(core): accept edits as a string or one object, hint a minimal call on a repeated argument error; close plan D - #489

Merged
lg2m merged 4 commits into
mainfrom
fix/plan-d-gaps
Oct 29, 2026
Merged

lg2m merged 4 commits into
mainfrom
fix/plan-d-gaps

Conversation

@lg2m

@lg2m lg2m commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Change

Closes plan section D (tool calls tell the model how to recover) by building the two items #485 left out:

  • edit_file accepts edits sent as a JSON-encoded string, or as one edit object without its array. The runtime rewrites them to the array when the call is admitted, so the stored call, approval preview, clients and compaction record all see the usual shape.
  • The second time a run gets the same argument-shape refusal for a tool (invalid arguments… or an invalid_* code), the error ends with a minimal valid call for that tool, e.g. the same error as before; a minimal valid call: read_file {"path":"README.md"}. The first error is unchanged. The loop guard sees the same result identity as before.

Section D is removed from docs/plans/README.md. The release check now notes the pending recount of repeated-error runs on a week of v0.1.10 use. docs/design/tools.md and docs/design/architecture.md describe the new behaviour.

Verification

  • cargo nextest run -p qq-core -E 'test(/edits_sent_as_a_string|a_repeated_argument_error|every_minimal_call|ac4_/)': passes. every_minimal_call_decodes decodes each example with its tool's real argument type, so an example can't drift from the schema. edit_file_arguments_are_stored_with_edits_as_a_list fails without the admission rewrite.
  • cargo xtask check on 671049c: fmt, lint and clippy pass. Tests had one wall-clock timeout per run, in different tests on each of two runs (sessions::tests::goals::revision_notices_across_reactive_checkpoint_overflow_reopen_in_order, headless::tests::closing_goal_host_drains_accepted_work_without_admitting_successors). Neither touches this change, and both pass when run alone. The goals test also passes alone on main.
  • I did not run the new tests against main. They should fail there, because edits was a strict list and there was no hint, but that is inferred.

Known impact

  • Acceptance for D still needs a week of v0.1.10 use to recount the repeated-error rate (baseline 9.6%). The v0.1.9 re-measure can't be done because the session store has no v0.1.9 runs.
  • Repeated argument refusals don't enter the loop guard's executed streak, so a third identical one gets the hinted error again rather than "not executed". This is the existing behaviour, now pinned by a test.
  • main's CI is currently red on run in place (windows-latest) at b6cdf6a, unrelated to this change.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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-29T02:36:09.914598Z 5397b5d 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: 671049c2be

ℹ️ 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-core/src/tools/edit.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: fdbc226fc5

ℹ️ 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-core/src/tools/edit.rs Resolved
lg2m added 4 commits October 28, 2026 19:15
…l on a repeated argument error; close plan D

- edit_file decodes `edits` sent JSON-encoded as a string or as a single
  edit object.
- The second identical argument-shape refusal in a run for the same tool
  appends a minimal valid call. The loop guard's result identity is
  unchanged.
- Plan section D is removed; the release check notes the pending recount
  of repeated-error runs on a week of v0.1.10 use.
…e object

The approval preview decoded edits strictly, so in Ask mode the overlay showed no path or diff for the shapes edit_file now accepts. It now uses the same decoder.
The decoder accepted an edits string or lone object, but the stored arguments kept that shape. Compaction's Files modified query, the TUI and the approval preview all read $.edits as an array: an encoded list dropped the edit from the record, and a lone object could fail the compaction query. The runtime now rewrites edits to the list when the call is admitted, so every reader sees one shape and the serde hooks go away.
@lg2m
lg2m merged commit 0ce1558 into main Oct 29, 2026
7 checks passed
@lg2m
lg2m deleted the fix/plan-d-gaps branch October 29, 2026 03:05
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