Skip to content

fix(agents): inherit subagent thinking defaults - #84007

Merged
steipete merged 8 commits into
openclaw:mainfrom
stevenepalmer:fix-subagent-thinking-defaults
May 31, 2026
Merged

steipete merged 8 commits into
openclaw:mainfrom
stevenepalmer:fix-subagent-thinking-defaults

Conversation

@stevenepalmer

@stevenepalmer stevenepalmer commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Intended outcome: subagents keep the caller's effective thinking behavior instead of silently falling back to a lower/default effort.
  • Precedence remains explicit spawn thinking, requester agent subagent default, target agent subagent default, global subagent default, then requester-session fallback.
  • Requester-session fallback resolves stored session thinking first, requester agent thinkingDefault second, and persisted selected/runtime/default-model thinking last.
  • Existing explicit/configured thinking behavior remains unchanged.
  • Out of scope: changing provider selection, model routing, or any live-provider execution semantics beyond the thinking default passed into the subagent session.
  • Review focus: the fallback ordering in src/agents/subagent-spawn-thinking.ts, persisted child-session thinkingLevel, and the regression coverage around explicit/configured overrides.

Linked context

Fixes #55790.

Related review context:

  • martingarramon flagged an earlier PR-body fallback-order mismatch; the documented order now matches the implementation and test expectation.
  • ClawSweeper previously requested stronger proof that native subagent spawning inherits thinking defaults.

Requested by a maintainer or owner:

  • The original issue describes the bug. Follow-up review comments requested documentation/proof clarification, which this body keeps in the current template.

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:

    • ./node_modules/.bin/vitest run src/agents/subagent-spawn.test.ts --config test/vitest/vitest.agents.config.ts
    • ./node_modules/.bin/vitest run src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts --config test/vitest/vitest.unit-fast.config.ts
    • node scripts/test-projects.mjs src/agents/subagent-spawn.test.ts src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts on pi-claw
    • Live gateway proof: call native sessions_spawn with runtime="subagent" and no thinking field, then inspect the child session status and trajectory.
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output):

    $ git branch --show-current
    fix-subagent-thinking-defaults
    
    $ ./node_modules/.bin/vitest run src/agents/subagent-spawn.test.ts --config test/vitest/vitest.agents.config.ts
    Test Files  1 passed
    Tests       10 passed
    
    $ ./node_modules/.bin/vitest run src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts --config test/vitest/vitest.unit-fast.config.ts
    Test Files  1 passed
    Tests       5 passed
    
    pi-claw branch checkout proof:
    [test] starting test/vitest/vitest.unit-fast.config.ts
    src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts
      6 tests passed
    
    [test] starting test/vitest/vitest.agents.config.ts
    src/agents/subagent-spawn.test.ts
      11 tests passed
    
    [test] passed 2 Vitest shards in 24.92s
    
    Live native sessions_spawn proof:
    Parent session status:
    OpenClaw 2026.5.18
    Model: openai-codex/gpt-5.5
    Session: agent:main:dashboard:c0098499-aab4-4abe-a285-e866e299c320
    Execution: direct . Runtime: OpenAI Codex . Think: medium . Text: low
    
    sessions_spawn input:
    {
      "runtime": "subagent",
      "mode": "run",
      "taskName": "pr_84007_live_thinking_proof",
      "cleanup": "keep",
      "context": "isolated",
      "task": "Live proof for PR #84007. Reply exactly: PR_84007_CHILD_DONE"
    }
    
    sessions_spawn result:
    {
      "status": "accepted",
      "childSessionKey": "agent:main:subagent:6ba2b844-766e-40a5-9a9e-808364c22bef",
      "runId": "9592e938-8b19-4309-84cf-46bb60227c85",
      "mode": "run",
      "taskName": "pr_84007_live_thinking_proof",
      "modelApplied": true
    }
    
    Child session status:
    OpenClaw 2026.5.18
    Model: openai/gpt-5.5
    Session: agent:main:subagent:6ba2b844-766e-40a5-9a9e-808364c22bef
    Tasks: latest succeeded . subagent . Live proof for PR #84007. Reply exactly: PR_84007_CHILD_DONE
    Execution: direct . Runtime: OpenAI Codex . Think: medium . Text: low
    
    Child trajectory excerpts:
    session.started:
      sessionKey=agent:main:subagent:6ba2b844-766e-40a5-9a9e-808364c22bef
      runId=9592e938-8b19-4309-84cf-46bb60227c85
      provider=openai-codex
      modelId=gpt-5.5
      authProfileId=[REDACTED]
    
    model.completed:
      assistantTexts=["PR_84007_CHILD_DONE"]
      timedOut=false
      promptError=null
    
  • 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:

  • ./node_modules/.bin/vitest run src/agents/subagent-spawn.test.ts --config test/vitest/vitest.agents.config.ts
  • ./node_modules/.bin/vitest run src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts --config test/vitest/vitest.unit-fast.config.ts
  • node scripts/test-projects.mjs src/agents/subagent-spawn.test.ts src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts
  • git diff --check upstream/main...HEAD
  • git merge-tree --write-tree origin/fix-subagent-thinking-defaults upstream/main

Regression coverage added or updated:

  • src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts
  • src/agents/subagent-spawn.test.ts
  • Supporting spawn-plan/runtime/thinking helper coverage for precedence and persisted child-session thinkingLevel.

Latest validation after the requester thinkingDefault precedence repair and upstream merge:

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.full-agentic.config.ts src/agents/subagent-spawn.test.ts src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts — passed, 40 tests.
  • pnpm -s check:test-types — passed.
  • git diff --check upstream/main...HEAD — passed.
  • git merge-tree --write-tree HEAD upstream/main — clean.

What failed before this fix, if known:

  • The subagent thinking resolver only handled explicit spawn input and configured subagent defaults. It did not receive requester session thinking, so omitted child thinking could lose the caller's persisted thinking level.

If no test was added, why not:

  • Not applicable; focused regression coverage was added.

Risk checklist

Did user-visible behavior change? (Yes/No)

  • Yes. Subagents spawned without explicit/configured thinking can now inherit the requester session's thinking level.

Did config, environment, or migration behavior change? (Yes/No)

  • No.

Did security, auth, secrets, network, or tool execution behavior change? (Yes/No)

  • No.

What is the highest-risk area?

  • Compatibility around thinking-precedence order and session-state fallback behavior.

How is that risk mitigated?

  • Explicit spawn thinking and configured subagent defaults still take precedence. Tests cover requester-agent defaults, target-agent defaults, global defaults, inherited requester session thinking, and explicit/configured override behavior.

Current review state

What is the next action?

  • ClawSweeper re-review or maintainer review after commit 7e7f11775e. The latest code update aligns requester thinkingDefault before selected/runtime model fallback while preserving the existing explicit/configured subagent precedence.

What is still waiting on author, maintainer, CI, or external proof?

  • Fresh ClawSweeper review is pending for the current head after this author-side code repair.

Which bot or reviewer comments were addressed?

  • martingarramon's fallback-order documentation mismatch was corrected.
  • ClawSweeper proof/validation requests and the requester thinkingDefault precedence finding were addressed with focused tests, Pi proof, live native sessions_spawn proof, and this current-template PR body.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 19, 2026
@clawsweeper

clawsweeper Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 31, 2026, 9:57 AM ET / 13:57 UTC.

Summary
The branch threads requester agent/session/model thinking defaults into native subagent spawn planning and adds focused regression coverage for precedence, persisted child thinking, and inherited-thinking forwarding.

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.

  • Implicit fallback path: 1 added. Subagent spawns without explicit or configured thinking now use requester/session thinking as a fallback, which is the compatibility-sensitive behavior maintainers need to notice before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Have a maintainer explicitly accept the omitted-thinking fallback contract before merge.

Risk before merge

  • [P1] Existing users who omit sessions_spawn.thinking may now get inherited requester high/medium/off or requester defaults instead of the previous lower/default child behavior; that is the intended fix but compatibility-sensitive.
  • [P1] The patch persists inherited or model-derived thinking into child session state, so maintainers should accept that as the native subagent session-state contract before merge.

Maintainer options:

  1. Accept inherited-thinking fallback (recommended)
    Merge the current behavior once maintainers agree that omitted native subagent thinking should inherit requester/session defaults and be persisted on the child session.
  2. Preserve legacy implicit default
    If maintainers do not want omitted spawns to change existing behavior, revise the branch so requester inheritance is opt-in or otherwise product-approved before merge.
  3. Pause rather than keep iterating
    If the team is not ready to choose the session-state contract, hold this PR and keep the linked issue open as the canonical product decision point.

Next step before merge

  • No automated repair is indicated; the remaining action is maintainer acceptance of the compatibility/session-state fallback before merge.

Security
Cleared: The diff changes agent runtime planning and tests only; it does not add dependencies, workflows, secret handling, permissions, downloads, or other supply-chain surfaces.

Review details

Best 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 changes

Label justifications:

  • P2: This is a normal-priority agent runtime bug fix with focused blast radius around native subagent thinking defaults.
  • merge-risk: 🚨 compatibility: Merging changes behavior for existing sessions_spawn callers that omit thinking and previously received the old default/lower child behavior.
  • merge-risk: 🚨 session-state: The change writes inherited or derived thinking into child session state, changing how native subagent session state is initialized.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes redacted live gateway output showing native sessions_spawn inheriting Think: medium into the child session, plus Raspberry Pi branch-checkout test output for the branch behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes redacted live gateway output showing native sessions_spawn inheriting Think: medium into the child session, plus Raspberry Pi branch-checkout test output for the branch behavior.
Evidence reviewed

PR surface:

Source +103, Tests +564. Total +667 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 5 112 9 +103
Tests 2 570 6 +564
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 682 15 +667

What I checked:

Likely related people:

  • tyler6204: Commit 64849e8 added the subagent default thinking docs, tool behavior, and focused tests that define the surface this PR repairs. (role: introduced related config surface; confidence: high; commits: 64849e81f5ae; files: docs/tools/subagents.md, src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts, src/agents/tools/sessions-spawn-tool.ts)
  • steipete: Recent history extracted the subagent spawn planning seams, and the latest two branch commits refine this PR's fallback/session-state behavior. (role: recent area contributor and likely follow-up owner; confidence: high; commits: 7b36fa76726a, 6bcce8d2bbf1, 65631b906e85; files: src/agents/subagent-spawn.ts, src/agents/subagent-spawn-plan.ts, src/agents/subagent-spawn-thinking.ts)
  • vincentkoc: Commit 74e7b8d touched the extracted subagent thinking/planning leaf surfaces involved in this resolver path. (role: recent refactor contributor; confidence: medium; commits: 74e7b8d47b18; files: src/agents/subagent-spawn-thinking.ts, src/agents/subagent-spawn-plan.ts, src/agents/subagent-spawn.ts)
  • martingarramon: PR discussion shows this reviewer checked the fallback-order wording and proof against the implementation, making them useful for review continuity. (role: reviewer; confidence: medium; files: src/agents/subagent-spawn-thinking.ts, src/agents/subagent-spawn.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. labels May 19, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 19, 2026
@clawsweeper

clawsweeper Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. labels May 19, 2026

@martingarramon martingarramon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@stevenepalmer

Copy link
Copy Markdown
Contributor Author

@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.

@stevenepalmer

Copy link
Copy Markdown
Contributor Author

Pi proof for PR #84007 is now complete.

Environment:

  • Real Raspberry Pi node: pi-claw
  • Architecture/kernel: aarch64, Linux 6.18.29+rpt-rpi-2712
  • Branch checkout on Pi: stevenepalmer:fix-subagent-thinking-defaults
  • Commit tested: 558cbe261a

Commands run on the Pi via the paired OpenClaw node host:

node scripts/test-projects.mjs \
  src/agents/subagent-spawn.test.ts \
  src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts

Result:

[test] starting test/vitest/vitest.unit-fast.config.ts
src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts
  6 tests passed

[test] starting test/vitest/vitest.agents.config.ts
src/agents/subagent-spawn.test.ts
  11 tests passed

[test] passed 2 Vitest shards in 24.92s

This covers the requested sessions_spawn(runtime="subagent") thinking-default behavior and the persisted child-session thinkingLevel cases on the Pi branch checkout. The tested precedence is:

explicit spawn -> requester agent config -> target agent config -> global config -> requester session thinking

Main also restored the Pi node exec approval file after the proof run.

@martingarramon

Copy link
Copy Markdown
Contributor

The description now matches the implemented precedence. Pi proof looks clean — aarch64 kernel, branch checked out directly, 5 thinking-inheritance tests pass. LGTM.

@clawsweeper

clawsweeper Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Frosted Merge Sprite

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: watches the merge queue.
Image traits: location review cove; accessory rollback rope; palette seafoam, black, and opal; mood determined; pose peeking out from the egg shell; shell smooth pearl shell; lighting subtle sparkle highlights; background tiny shells and proof notes.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Frosted Merge Sprite in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@stevenepalmer

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I moved the real Pi proof into the PR body using the exact proof field labels.

Proof summary:

  • Real Raspberry Pi node: pi-claw
  • aarch64 Linux 6.18.29+rpt-rpi-2712
  • Branch checkout: stevenepalmer:fix-subagent-thinking-defaults
  • Commit tested: 558cbe261a
  • Command: node scripts/test-projects.mjs src/agents/subagent-spawn.test.ts src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts
  • Result: 2 Vitest shards passed in 24.92s; 6 sessions_spawn thinking-default tests + 11 subagent spawn tests passed.

martingarramon also reviewed the updated precedence wording and Pi proof and left LGTM: #84007 (comment)

@stevenepalmer

Copy link
Copy Markdown
Contributor Author

@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:

  • Parent live session: Think: medium.
  • Native sessions_spawn(runtime="subagent") call omitted the thinking field.
  • Spawn result accepted child session agent:main:subagent:6ba2b844-766e-40a5-9a9e-808364c22bef.
  • Child live session status after completion: Think: medium.
  • Child trajectory shows session.started/model.completed for run 9592e938-8b19-4309-84cf-46bb60227c85 and assistant output PR_84007_CHILD_DONE.

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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 22, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 22, 2026
@stevenepalmer

Copy link
Copy Markdown
Contributor Author

Pushed a2cf6a089a to resolve the persisted caller-model thinking fallback.

Validation:

  • pnpm -s vitest run src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts --config test/vitest/vitest.unit-fast.config.ts passed (1 file, 9 tests)
  • pnpm -s vitest run src/agents/subagent-spawn.test.ts --config test/vitest/vitest.agents.config.ts passed (1 file, 17 tests)
  • pnpm -s check:test-types passed
  • git diff --check upstream/main...HEAD passed

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@martingarramon

Copy link
Copy Markdown
Contributor

Body updated. The documented precedence now puts requester agent subagent default before target agent subagent default, matching resolvedThinkingDefaultRaw and the test expectation. LGTM.

@stevenepalmer

Copy link
Copy Markdown
Contributor Author

Updated fix-subagent-thinking-defaults with 36812f3cea to merge current upstream/main and resolve the subagent thinking conflict.

Validation passed:

  • node scripts/test-projects.mjs src/agents/subagent-spawn.test.ts src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts
  • pnpm -s check:test-types
  • git diff --check upstream/main...HEAD
  • git merge-tree --write-tree HEAD upstream/main

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@stevenepalmer

Copy link
Copy Markdown
Contributor Author

Updated fix-subagent-thinking-defaults with fb4c336ff3 to narrow the branch to the subagent thinking implementation and focused tests only.

Removed the unrelated generated viewer/template/script/UI/extension churn from the PR diff by rebuilding the branch on current upstream/main.

Validation passed:

  • node scripts/test-projects.mjs src/agents/subagent-spawn.test.ts src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts
  • pnpm -s check:test-types
  • git diff --check upstream/main...HEAD
  • git merge-tree --write-tree HEAD upstream/main

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@martingarramon

Copy link
Copy Markdown
Contributor

PR body documents the precedence as explicit spawn → requester agent config → target agent config → global config → requester session thinking, matching subagent-spawn-thinking.ts:22–27. CI green. LGTM.

@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@stevenepalmer

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Refreshed this branch onto current upstream main after the Dependency Guard update notice.

Validation on 227aea18d9:

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.full-agentic.config.ts src/agents/subagent-spawn.test.ts src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts passed
  • git diff --check upstream/main...HEAD passed
  • git merge-tree --write-tree HEAD upstream/main is clean

@clawsweeper

clawsweeper Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@stevenepalmer

Copy link
Copy Markdown
Contributor Author

@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:

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.full-agentic.config.ts src/agents/subagent-spawn.test.ts src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts
  • pnpm -s check:test-types
  • git diff --check upstream/main...HEAD
  • git merge-tree --write-tree HEAD upstream/main

@clawsweeper

clawsweeper Bot commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper

clawsweeper Bot commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor

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:

  • node scripts/run-vitest.mjs src/agents/openclaw-tools.subagents.sessions-spawn-applies-thinking-default.test.ts src/agents/subagent-spawn.test.ts
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main

Evidence after fix:

  • Local targeted Vitest passed: 2 shards, 9 + 22 tests, 13.29s.
  • git diff --check passed.
  • Autoreview clean: no accepted/actionable findings reported.
  • CI run 26714296120 passed, including build-artifacts job 78730058407 and check-test-types job 78730058492.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sessions_spawn(runtime="subagent") ignores inherited/per-agent subagent thinking defaults and initializes children at low

4 participants