Skip to content

fix(delegate): add do-not-use guidance to acp schema (carve-out of #22680)#22806

Merged
teknium1 merged 1 commit into
mainfrom
salvage/pr-22680-delegate-schema-only
May 9, 2026
Merged

fix(delegate): add do-not-use guidance to acp schema (carve-out of #22680)#22806
teknium1 merged 1 commit into
mainfrom
salvage/pr-22680-delegate-schema-only

Conversation

@teknium1

@teknium1 teknium1 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Carve-out of #22680 — keeps just the delegate_task schema-text changes that target #22013, drops the unrelated bundled fixes for #22548 / #21944 / #22150.

Root cause (for #22013)

tools/delegate_tool.py schema descriptions for acp_command / acp_args previously 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-level acp_command description. Same at the per-task override. Strengthen acp_args to mention it stays empty unless acp_command is 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_args remain 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

  • 9/9 schema/acp tests pass on the salvage branch.

Closes #22013 via salvage.

…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.
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: salvage/pr-22680-delegate-schema-only vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 7919 on HEAD, 7906 on base (🆕 +13)

🆕 New issues (7):

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.

@teknium1 teknium1 merged commit ca13993 into main May 9, 2026
16 of 18 checks passed
@teknium1 teknium1 deleted the salvage/pr-22680-delegate-schema-only branch May 9, 2026 20:37
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder tool/delegate Subagent delegation labels May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists tool/delegate Subagent delegation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: delegate_task hard-codes bias toward Claude platforms causes errors when user does not use Claude and does not have Claude platforms installed.

3 participants