fix(delegate): add do-not-use guidance to acp schema (carve-out of #22680)#22806
Merged
Conversation
…gs schema (carve-out of #22680) acp_command / acp_args descriptions previously primed the model to populate them — "Per-task ACP command override (e.g. 'copilot')" — even when no ACP CLI was installed. Models with weaker schema-following discipline would set them and the spawn would fail. Add explicit "Do NOT set unless the user has explicitly told you" guidance at both the top-level acp_command and the per-task override. Strengthen acp_args to mention it's empty unless acp_command is set. Adds 2 tests pinning the descriptions. Note: this is a cosmetic prompt-engineering fix — the params remain exposed in the schema. The fully-correct fix is to gate them behind a config flag or runtime ACP-CLI detection so the schema only emits them when an ACP harness is available. Tracked as a follow-up; this PR ships the low-cost stopgap. Salvage of #22680 (delegate schema only). The original PR also bundled unrelated fixes for #22548, #21944, #22150 — those need separate PRs since #22548 and #21944 are already addressed on main (#22780 + #22798 in flight) and #22150 deserves its own review. Closes #22013.
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
invalid-argument-type |
6 |
unresolved-attribute |
1 |
First entries
tests/tools/test_delegate.py:2057: [unresolved-attribute] unresolved-attribute: Attribute `lower` is not defined on `dict[str, str]`, `dict[str, str | dict[str, dict[str, str] | dict[str, str | dict[str, str]] | dict[str, str | list[str]]] | list[str]]`, `list[str]` in union `Unknown | str | dict[str, str] | dict[str, str | dict[str, dict[str, str] | dict[str, str | dict[str, str]] | dict[str, str | list[str]]] | list[str]] | list[str]`
tests/tools/test_delegate.py:2048: [invalid-argument-type] invalid-argument-type: Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> str, (s: slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[str]]` cannot be called with key of type `Literal["acp_command"]` on object of type `list[str]`
run_agent.py:12879: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
run_agent.py:6835: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
tests/tools/test_delegate.py:2057: [invalid-argument-type] invalid-argument-type: Method `__getitem__` of type `Overload[(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> LiteralString, (key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str]` cannot be called with key of type `Literal["acp_command"]` on object of type `str`
tests/tools/test_delegate.py:2057: [invalid-argument-type] invalid-argument-type: Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown, (s: slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[Unknown]]` cannot be called with key of type `Literal["acp_command"]` on object of type `list[Unknown]`
run_agent.py:12882: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown, Unknown] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
✅ Fixed issues (3):
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
First entries
run_agent.py:6835: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
run_agent.py:12882: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown | str, Unknown | str | dict[str, str]] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
run_agent.py:12879: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
Unchanged: 4177 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
Closed
4 tasks
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.
Summary
Carve-out of #22680 — keeps just the
delegate_taskschema-text changes that target #22013, drops the unrelated bundled fixes for #22548 / #21944 / #22150.Root cause (for #22013)
tools/delegate_tool.pyschema descriptions foracp_command/acp_argspreviously read like canonical examples ("e.g. 'copilot'"/"Arguments for the ACP command (default: ['--acp', '--stdio'])") — priming the model to populate them even when no ACP CLI was installed on the user's box. Models with weaker schema-following discipline would set them; the spawn would then fail with confusing errors.Changes (contributor commit, re-authored to wesleysimplicio)
tools/delegate_tool.py: add explicit"IMPORTANT: Do NOT set this unless the user has explicitly told you a specific ACP-compatible CLI is installed"at the top-levelacp_commanddescription. Same at the per-task override. Strengthenacp_argsto mention it stays empty unlessacp_commandis set.tests/tools/test_delegate.py: 2 tests pinning the descriptions (no-Claude-as-example + presence of "Do NOT set" guidance).Note on scope
This is a cosmetic prompt-engineering fix —
acp_command/acp_argsremain exposed in the schema at all times. The fully-correct fix is gating them behind a config flag or runtime ACP-CLI detection so the schema only emits them when an ACP harness is actually available. Tracked as a follow-up.Salvage rationale
The original PR #22680 by @wesleysimplicio bundled this delegate-schema fix together with unrelated changes for #22548 (timeout classification + fallback self-skip), #21944 (DeepSeek thinking blocks), and #22150 (session_search content_session_id routing). #22548 and #21944 are already addressed on main (#22780 merged, #22798 in flight from a focused salvage of #22643). #22150 deserves its own review. Carving out just the delegate schema changes here so the title-described work lands cleanly.
Author credited as wesleysimplicio.
Validation
Closes #22013 via salvage.