Skip to content

refactor(engine): drop the deprecated Subagent max_tokens argument - #1634

Merged
JAORMX merged 4 commits into
mainfrom
worktree-drop-subagent-max-tokens
Sep 16, 2026
Merged

JAORMX merged 4 commits into
mainfrom
worktree-drop-subagent-max-tokens

Conversation

@blkt

@blkt blkt commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the deprecated max_tokens argument from the Subagent tool. It was an alias for
max_run_tokens — same cumulative input+output run budget — under a name that read as a
provider output-token cap. One argument now, so resolveMaxRunTokens loses the two-alias
fold and the conflicting-values rejection with it.

Living docs and an engine CHANGELOG Removed entry follow. ADR 0015 is untouched: frozen
ADRs get superseded, not edited.

  • Work classification: Routine
  • Decision record: None — removing a deprecated alias, no new architectural decision
  • Human waiver of spine: Yes — directed by @michelangelomori

Type of change

  • Other: deprecation removal (model-facing, no Go API change)

Test plan

User-facing change

A Subagent call still emitting max_tokens now has that key ignored; the child inherits
the operator/engine budget. Use max_run_tokens.

blkt and others added 2 commits September 16, 2026 16:46
`max_tokens` was a DEPRECATED alias for `max_run_tokens` on the Subagent
tool: both named the same cumulative input+output RUN budget, while the
shorter name read as a provider single-response output ceiling it never
was. Remove it so there is exactly one per-call budget argument.

- `subagentArgs.MaxTokens` and the `max_tokens` schema property are gone.
- `resolveMaxRunTokens` no longer folds two aliases: it returns the single
  positive value, or 0 for "inherit the engine budget". The two-alias
  conflict rejection in `run()` ("set only one of max_run_tokens or the
  deprecated max_tokens ...") is therefore removed with it.
- The three alias-only tests (backward-compat, conflict, same-value) are
  dropped; the remaining budget tests move to `max_run_tokens`.
- Living docs (AGENTS.md, docs/architecture/*, IMPLEMENTATION-NOTES) and an
  engine CHANGELOG "Removed" entry follow. ADR 0015 is left untouched — a
  frozen ADR is superseded, never edited.

No exported identifier changes (`subagentArgs` is unexported), so
`task api:check` passes with no baseline update. Model-facing behaviour
change only: a call still emitting `max_tokens` now has that key ignored
and the child inherits the operator/engine budget.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…kens arg

TestSubagentPerCallMaxTokens{HitsBudgetTerminal,TightenOnly} named an
argument that no longer exists. Rename to MaxRunTokens, including the
cross-reference from TestSubagentResumeBudgetTightenOnly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@JAORMX

JAORMX commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

You might wanna edit the notes to remove the comments about the field being removed.

blkt and others added 2 commits September 16, 2026 18:31
The notes are the living "how it works now" reference; a tombstone for a
removed argument belongs in engine/CHANGELOG.md, which already records it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Cosmetic only — restores the file's line wrapping where removing the alias
text left short lines.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@JAORMX
JAORMX merged commit 12a7ef1 into main Sep 16, 2026
35 checks passed
@JAORMX
JAORMX deleted the worktree-drop-subagent-max-tokens branch September 16, 2026 17:39
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Sep 21, 2026
2 tasks
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.

2 participants