Repository navigation
fix(agent-core): omit empty tools and stop invalid request retries - #2169
Open
ShiboSheng wants to merge 1 commit into
Open
ShiboSheng wants to merge 1 commit into
ShiboSheng wants to merge 1 commit into
Conversation
OpenAI-compatible final summaries could send an empty tools list with an automatic tool choice. Strict providers reject that request, and the retry wrapper repeatedly sent the same invalid payload. Build tool parameters once for streaming and whole-response calls, reject missing forced tools locally, and classify remaining HTTP 400 responses as non-retryable invalid requests. Preserve modified-request recovery, fallback providers, and transient-error retries. Add HTTP contract tests and a loopback fixture for packaged-app verification. Verification: - cargo test -p agent_core --lib: 3,772 passed, 4 ignored - cargo clippy --all-targets -- -D warnings: passed - pnpm run lint; pnpm run check:circular; selected frontend tests: passed - node --test scripts/dev/provider-fixture-server.test.cjs: 2 passed - BuildFast packaged app: strict and lenient summaries, 400 fail-fast, 503 recovery, stop, restart, retry, and ordinary tools exercised The separate Org wake/finality stall under near-instant fixture responses remains outside this patch and is recorded in the verification document. Pre-commit hook ran. Total eslint: 0, total circular: 0
ShiboSheng
marked this pull request as ready for review
October 12, 2026 09:54
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Org's text-only final report could reach an OpenAI-compatible provider as
tools: []plustool_choice: "auto". Strict providers reject that combination with HTTP 400, and the reliability wrapper repeated the same invalid request; the packaged baseline reproduced 11 rejected report requests over about 65.5 seconds.Solution
InvalidRequest, retaining the status, parameter, and readable reason. Stop same-provider retries for that error while preserving fallback providers, modified-request recovery, and transient-error retries. Frontend conversion keeps the existingUNKNOWNcode withisRetryable=false.Potential risks
AtomicUsize::fetch_updatecall incrates/search/src/code/commands/text_search.rs:27. The same line exists ondevelopand this PR does not change that file; CI's Rust 1.99 treats the deprecation as an error. This independent search-module fix should be handled separately before merging this PR.Verification
cargo test -p agent_core --lib(fromsrc-tauri) — 3,772 passed, 4 ignored.cargo clippy --all-targets -- -D warnings(fromsrc-tauri) — passed; the commit hook also passed scopedagent_coreClippy.pnpm run lint,pnpm run check:circular, andgit diff --check— passed.AgentOrgFinalSummaryCard.test.ts,useSubmitMessage.test.ts, anduseQueueDispatch.classify.test.ts— 31 passed.node --test scripts/dev/provider-fixture-server.test.cjs— 2 passed.pnpm run tauri:build:fast -- /tmp/org-empty-tools-fixed-app --instance 99— packaged app built and exercised through its UI. Strict and lenient final reports omitted both tool fields; a report HTTP 400 caused one request, while HTTP 503 caused one retry then success. Also exercised Stop during a delayed response, retry of an existing failed report, real quit/restart without duplicate summary, and an ordinary agent shell-tool write/read.scripts/dev/org-request-contract-verification.mdfor the local reproduction and limits. No user-visible UI component changed, so UI screenshots do not help review this request-contract change.