Repository navigation
feat(delegation): choose a sub-agent's reasoning effort from its roster role (RR8.4) - #201
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14a60e6ab7
ℹ️ 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".
14a60e6 to
7dd0791
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7dd07916d0
ℹ️ 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".
| } else if ladder.is_empty() || ladder.contains(&derived) { | ||
| Some(derived) |
There was a problem hiding this comment.
Preserve provider-default effort for unsupported adapters
Fresh evidence after the earlier worker-model comment: this new empty-ladder branch assigns low/medium to Bedrock and Bedrock Mantle roster entries, even though their catalog ladders are intentionally empty because ResolvedModel.generation.reasoning_effort is Unsupported for non-HTTP access and both adapters reject any concrete effort. Consequently, the default balanced roster entry—including one synthesized from legacy worker_model—fails child preflight with UnsupportedReasoningEffort instead of spawning. Treat an empty ladder on an effort-unsupported route as Default rather than as permission to use the derived value.
Useful? React with 👍 / 👎.
| .copied() | ||
| .filter(|level| rank(*level) <= derived_rank) | ||
| .max_by_key(|level| rank(*level)) | ||
| .or_else(|| ladder.iter().copied().min_by_key(|level| rank(*level))) |
There was a problem hiding this comment.
Do not raise children above the parent's effort ceiling
When the derived ceiling is below every advertised rung, this fallback selects the route's lowest rung even though it is higher than the parent. For example, a minimal parent delegating to a [low, high] route derives minimal but is rewritten to low, violating the stated invariant that a child never thinks harder than its parent; the same fallback also rewrites a strong parent's explicit default to the lowest rung because Default has no rank. Preserve provider default or reject the spawn when no advertised level satisfies the ceiling instead of falling upward.
Useful? React with 👍 / 👎.
| route: ModelRoute, | ||
| role: DelegationRole, | ||
| note: Option<String>, | ||
| effort: Option<qq_provider::ReasoningEffort>, |
There was a problem hiding this comment.
Expose roster effort in config show
Adding DelegationEntry::effort without updating print_snapshot leaves qq config show unable to display the effective value: src/main.rs:1123-1131 prints each roster entry's route, role, and note only. Thus configurations that explicitly pin effort: high produce the same inspection output as configurations that derive effort from the role, which is especially misleading when diagnosing child cost or admission failures. Include the explicit effort, or a clear derived marker, in each printed delegation entry.
Useful? React with 👍 / 👎.
| pub note: Option<String>, | ||
| /// The reasoning effort children spawned on this entry run at. `None` | ||
| /// derives one from the role: `fast` → low, `balanced` → medium, never | ||
| /// above the parent's own effort; `strong` inherits the parent's. | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] |
There was a problem hiding this comment.
Document effort in the capabilities wire contract
This adds effort to the externally serialized delegation roster, but docs/design/protocol.md:539-550 still defines every advertised roster-entry field without mentioning it or its derived-role semantics. Clients implementing the capabilities contract therefore cannot tell that the optional value is behavior-affecting, how None is interpreted, or why the server may return a concrete derived value even when configuration omitted one. Amend the protocol design alongside this wire-field addition.
AGENTS.md reference: AGENTS.md:L205-L210
Useful? React with 👍 / 👎.
7dd0791 to
97ed7af
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97ed7afa02
ℹ️ 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".
4cb21df to
194a765
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 194a7653a9
ℹ️ 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".
…er role (RR8.4) Children inherited the parent session's effort pin verbatim, so a read-only review worker under `max` spent ~14 k hidden reasoning tokens per read_file turn (the audited 33-minute run). The effort is now chosen at spawn from the roster entry the call resolved through: an explicit `effort` on the entry wins; otherwise fast → low and balanced → medium, each capped by the parent's own pin, and strong inherits. The chosen value is written to the child's session row in the creation transaction so the loader, replay and clients agree. Legacy worker-model spawns and audits inherit as before. Config: `delegation.roster[].effort`. Protocol: `DelegationRosterEntry.effort` (optional, additive; goldens unchanged) and `child_reasoning_effort`. Tests: child_effort_derives_from_the_role_and_never_exceeds_the_parent, a_balanced_child_of_a_max_effort_parent_is_admitted_at_medium, roster effort round-trip in delegation_roster_layers_validates_…. Linear: ENG-956
…an descriptor to v11 (RR8.4 review) A role-derived effort (fast → low, balanced → medium) ignored what the child's route accepts: `fast` onto a model without reasoning sent an effort the provider rejects, and `balanced` onto a route advertising only `[low, high]` failed admission as ReasoningEffortNotAdvertised. When the root builds the roster from a catalog it knows, a derived effort is now fitted first: a model without reasoning takes `default` (nothing sent) and a ladder lacking the level yields the highest rung at or below it. An explicit entry effort is untouched and validated at the child's load as before. Test: a_derived_roster_effort_is_fitted_to_the_child_route. `DelegationRosterEntry.effort` changed the descriptor's canonical bytes without the version bump the module requires: DESCRIPTOR_VERSION 10 → 11 (#194 took v10 for MCP pins), digest domain and golden re-pinned, `delegation.effort` added to the mutation test. Docs: `worker_model` is a balanced roster entry and runs at medium; the text claiming it "inherits as before" was wrong. Ledger records the review round. Linear: ENG-956
…ledger round four
194a765 to
10d1163
Compare
RR8.4: per-role reasoning effort for sub-agents
Spec: docs/plans/run-reliability.md (RR8) Linear: ENG-956 Stack: 4/4, on ENG-955
What changed
qq_protocol::child_reasoning_effort(entry, parent): an explicit rostereffortwins; otherwisefast→low,balanced→medium, each capped by the parent's own pin (a child never thinks harder than the run that delegated to it);stronginherits.resolve_delegation_routereturns the chosen effort with the route;SpawnRequest/ChildAdmissioncarry it;create_child_runwrites it to the child's session row in the creation transaction (COALESCE(?17, parent's)), so the loader, replay and clients agree.delegation.roster[].effort. Protocol: optionalDelegationRosterEntry.effort(additive,skip_serializing_if; wire goldens unchanged,PROTOCOL_VERSIONunchanged). Plan descriptorDESCRIPTOR_VERSION10 → 11.default, i.e. nothing sent; a ladder lacking the level → the highest rung at or below it), so a default role never makes its child unspawnable.worker_modelis abalancedroster entry and runs atmediumlike one; audits inherit.effort: maxspending ~14 k reasoning tokens perread_fileturn.How verified
child_effort_derives_from_the_role_and_never_exceeds_the_parenta_balanced_child_of_a_max_effort_parent_is_admitted_at_medium(session-level: parent pinnedmaxviaSetSessionEffort, childPromptQueuedsummary showsmedium)delegation_route_resolution_prefers_model_then_role_then_defaultextended; config round-trip indelegation_roster_layers_validates_…Docs
docs/design/architecture.md§ delegation;docs/guide/configuration.md§ delegation; ledgerdocs/plans/progress/run-reliability.md.Compatibility
PROTOCOL_VERSIONunchanged (30). Descriptor: version 11; roster serialization gainseffortonly when set. Schema: none.Evidence
Operator store, read-only: two
provider_output_truncatedruns onlitellm/us.anthropic.claude-fable-5-1(2026-09-23, 2026-09-25). Every failing turn persistedassistant_content_json = []withoutput_tokens = 16384; every continuation request hadinput_tokens = 2uncached (byte-identical resend). Route-wide since 09-10: 3 935 turns, 49 truncated, 31 empty, ≈ 671 k output tokens and ≈ 2 h wall producing nothing.Review round (Codex)
DESCRIPTOR_VERSION10 → 11 (feat(mcp)!: pin MCP tool sets in config and plan identity; enforce at dispatch; add qq mcp inspect #194 took v10 for MCP pins; digest domain, golden digest, and the mutation test coverdelegation.roster[].effort).fast→ a non-reasoning model sent an effort the provider rejects;balanced→ a[low, high]route failed admission atmedium). The root now fits a derived effort to the catalog entry when building the roster; explicit entry efforts are unchanged. Test:a_derived_roster_effort_is_fitted_to_the_child_route.effortcovers a discovered-only route); an ADR for the descriptor bump (an optional field that isNonefor every existing config is not a behavioural identity change);reasoning_effortsdeclared withoutreasoning: true(contradictory config; validation if anywhere).worker_modelis abalancedroster entry and runs atmediumlike one; the "inherits as before" wording was wrong and is corrected. Audits still inherit.Gates (run on the stack tip and on this branch's tip)
cargo fmt --all -- --check✅cargo clippy --workspace --all-targets --all-features -- -D warnings✅ (every branch tip)cargo test --workspace✅ all passing at the stack tip; each intermediate tip compiles and passesqq/qq-core/qq-provideron its own.cargo test -p qq-provider --no-default-features --features test-support✅ 184 passed.qq-clientbuild ✅