Repository navigation
fix(agents): inherit subagent thinking defaults - #84007
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 31, 2026, 9:57 AM ET / 13:57 UTC. Summary PR surface: Source +103, Tests +564. Total +667 across 7 files. Reproducibility: yes. at source level: current main's resolver and callsite have no requester-session thinking input, matching the linked report where a child spawned without thinking falls to low/default. I did not run a live current-main repro in this read-only review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused fallback fix after maintainers accept the omitted-thinking inheritance contract, keeping explicit and configured thinking precedence unchanged. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main's resolver and callsite have no requester-session thinking input, matching the linked report where a child spawned without thinking falls to low/default. I did not run a live current-main repro in this read-only review. Is this the best way to solve the issue? Yes, the proposed direction is the narrow maintainable fix: it feeds caller thinking into the existing spawn planner, persists inherited thinking as child session state, and avoids forwarding inherited thinking as an explicit agent override. The remaining question is maintainer acceptance of the compatibility/session-state contract, not an automated code repair. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against a7075f363433. Label changesLabel justifications:
Evidence reviewedPR surface: Source +103, Tests +564. Total +667 across 7 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
martingarramon
left a comment
There was a problem hiding this comment.
The fallback chain in resolveSubagentThinkingOverride is correctly ordered and the session-state read is safe (readRequesterThinkingLevel catches errors and returns undefined, so a missing or unreadable session store doesn't break spawning). One documentation mismatch to fix before merge:
PR body description doesn't match code
The summary says the fallback order is "explicit spawn thinking, target agent subagent default, global subagent default, then requester session thinking." But the code places requesterAgentConfig.subagents.thinking before targetAgentConfig.subagents.thinking in resolvedThinkingDefaultRaw, and the test "prefers requester-agent subagent thinking over target-agent subagent thinking" confirms this is intentional. The correct order is: explicit spawn → requester agent config → target agent config → global config → requester session thinking.
The body should document this precedence clearly so maintainers can consciously approve it.
Core implementation: confirmed correct
readRequesterThinkingLevel reads entry.thinkingLevel from the requester's session store — the right source. The thinkingCandidateRaw fallback order is correctly guarded: params.thinkingOverrideRaw || resolvedThinkingDefaultRaw || params.callerThinkingRaw. Config-derived values take precedence over session state.
|
@martingarramon thanks for the catch. I updated the PR body to match the implemented precedence exactly: explicit spawn -> requester agent config -> target agent config -> global config -> requester session thinking. No code change was needed because the resolver/tests already enforce this order. |
|
Pi proof for PR #84007 is now complete. Environment:
Commands run on the Pi via the paired OpenClaw node host: Result: This covers the requested
Main also restored the Pi node exec approval file after the proof run. |
|
The description now matches the implemented precedence. Pi proof looks clean — aarch64 kernel, branch checked out directly, 5 thinking-inheritance tests pass. LGTM. |
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Frosted Merge Sprite Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
|
@clawsweeper re-review I moved the real Pi proof into the PR body using the exact proof field labels. Proof summary:
martingarramon also reviewed the updated precedence wording and Pi proof and left LGTM: #84007 (comment) |
|
@clawsweeper re-review Added the requested rank-up proof to the PR body: redacted live native sessions_spawn output showing inherited child thinking level. Key evidence:
I redacted auth/account details and did not paste full prompts. The earlier Pi proof remains in the PR body for branch-checkout aarch64 test coverage. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Pushed Validation:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Body updated. The documented precedence now puts requester agent subagent default before target agent subagent default, matching resolvedThinkingDefaultRaw and the test expectation. LGTM. |
|
Updated Validation passed:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Updated Removed the unrelated generated viewer/template/script/UI/extension churn from the PR diff by rebuilding the branch on current Validation passed:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
PR body documents the precedence as explicit spawn → requester agent config → target agent config → global config → requester session thinking, matching |
|
Heads up: this PR needs to be updated against current |
|
@clawsweeper re-review Refreshed this branch onto current upstream Validation on
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Updated fix-subagent-thinking-defaults with 7e7f11775e to honor requester agent thinkingDefault before selected/runtime model thinking fallback when no stored session thinking exists. The selected/runtime fallback tests still cover the no-agent-default path. Validation passed:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Behavior addressed: subagent spawn thinking precedence now follows explicit sessions_spawn.thinking, requester agent subagent default, global subagent default, then caller inheritance. Inherited caller thinking seeds the spawned session state without turning into an explicit gateway override. Real environment tested: local targeted Vitest in this checkout plus GitHub Actions on PR head 65631b9. Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: configured subagent thinking still forwards an explicit override; inherited requester thinking only initializes spawned session thinkingLevel and preserves agent/model default resolution. What was not tested: full local suite; GitHub Actions covered the broad PR gate. |
Summary
This PR fixes subagent thinking defaults so a child spawned through sessions_spawn(runtime="subagent") can inherit the requester session's persisted thinking level when the spawn request and configured subagent defaults do not specify one.
Linked context
Fixes #55790.
Related review context:
Requested by a maintainer or owner:
Real behavior proof (required for external PRs)
Behavior or issue addressed: sessions_spawn(runtime="subagent") preserves requester session thinking as the final fallback when explicit spawn thinking and configured subagent defaults are absent.
Real environment tested: Local OpenClaw checkout on Linux; Raspberry Pi node pi-claw on aarch64 Linux; running OpenClaw gateway 2026.5.18 for the live native spawn proof.
Exact steps or command run after this patch:
Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output):
Observed result after fix: The parent live session ran with Think: medium; the native subagent spawn omitted thinking; the child subagent also ran with Think: medium and completed the assigned task. The branch-checkout tests also verify explicit/configured thinking still takes precedence over inherited requester-session thinking, and the latest focused regression verifies requester agent thinkingDefault wins before selected/runtime model thinking fallback.
What was not tested: A paid external model-provider call from the local test harness, and private auth profile values/full prompts were not included in public proof.
Proof limitations or environment constraints: Live gateway proof redacts auth details and captures the native spawn/session behavior rather than exposing provider credentials. The later branch-head refinements are covered by focused regression tests and review comments.
Before evidence (optional but encouraged): The pre-fix resolver had no requester-session thinking fallback path, so a parent session's persisted thinking level could be dropped unless repeated in spawn input or config.
Tests and validation
Commands run for this PR:
Regression coverage added or updated:
Latest validation after the requester thinkingDefault precedence repair and upstream merge:
What failed before this fix, if known:
If no test was added, why not:
Risk checklist
Did user-visible behavior change? (Yes/No)
Did config, environment, or migration behavior change? (Yes/No)
Did security, auth, secrets, network, or tool execution behavior change? (Yes/No)
What is the highest-risk area?
How is that risk mitigated?
Current review state
What is the next action?
What is still waiting on author, maintainer, CI, or external proof?
Which bot or reviewer comments were addressed?