Skip to content

feat(agents): allow thinking overrides on visible sessions - #135296

Closed
sunlit-deng wants to merge 2 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-134530
Closed

sunlit-deng wants to merge 2 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-134530

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Rebase and review update (2026-10-26)

Rebased sunlit/fix/issue-134530 onto openclaw/main at d777ae1239625a8cadb3da17e7a057d0c4de71fa. The first rebase onto 4a97c0a9c637e7ef92cdbcf8183c48293f602e04 had conflicts in four source/test files and three prompt snapshots; those were resolved while preserving current main behavior and regenerating the snapshots. After main advanced, a rebase onto 28e277436e7055d3e5de159299663464ea0a2c6c completed without conflicts. The subsequent rebase onto d777ae1239625a8cadb3da17e7a057d0c4de71fa had conflicts in two prompt snapshots; they were resolved from the latest main state and regenerated against the final tool descriptions.

Conflicted files: src/agents/tool-description-presets.test.ts, src/agents/tools/sessions-spawn-outcome.test.ts, src/agents/tools/sessions-spawn-tool.input.test-support.ts, src/agents/tools/sessions-spawn-visible.ts, test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/discord-group-codex-message-tool.md.diff, test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/telegram-direct-codex-message-tool.md, and test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/telegram-heartbeat-codex-tool.md.diff.

The later rebase onto d777ae1239625a8cadb3da17e7a057d0c4de71fa conflicted again in test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/discord-group-codex-message-tool.md.diff and test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/telegram-direct-codex-message-tool.md; both were regenerated and validated.

What Problem This Solves

Adds explicit thinking-level control to visible sessions_spawn sessions while leaving omitted values under the Gateway's child-session default.

Fixes #134530

Why This Change Was Made

Visible spawning forwards only an explicitly supplied thinking value to sessions.create. The shared thinking resolver normalizes supported levels for the resolved model and corrected retry calls. Omitted values remain controlled by the Gateway.

User Impact

Visible child sessions can request a supported thinking level. Calls that omit it keep the Gateway-selected default.

Maintainer Decision

The requested explicit override for visible sessions_spawn calls is approved. The tool validates and forwards a supplied value to sessions.create, and preserves it when a visible call is corrected and retried. If thinking is omitted, the tool omits the field so the Gateway continues to select the default.

Evidence

  • Pinned validation base: d777ae1239625a8cadb3da17e7a057d0c4de71fa.
  • Exact tested HEAD: 0f516fbdab32c97978473de00ea1b62ae96bfec3.
  • Reproducible shipped-CLI proof source: test/proofs/proof-pr135296-visible-thinking-cli.mts.
  • Each scenario starts an independent production Gateway process, runs the shipped openclaw agent CLI, uses a deterministic OpenAI Responses endpoint bound to 127.0.0.1, and reads the resulting session through production gateway call sessions.list. No external provider or agent-command/discovery mocks are used.

Run each scenario from the repository root:

node --import ./scripts/tsx.mjs test/proofs/proof-pr135296-visible-thinking-cli.mts --scenario=explicit
node --import ./scripts/tsx.mjs test/proofs/proof-pr135296-visible-thinking-cli.mts --scenario=omitted
node --import ./scripts/tsx.mjs test/proofs/proof-pr135296-visible-thinking-cli.mts --scenario=corrected
node --import ./scripts/tsx.mjs test/proofs/proof-pr135296-visible-thinking-cli.mts --scenario=invalid

Captured fields from the four exact-HEAD proof JSON results (passed: true in each):

explicit:  head=0f516fbdab32c97978473de00ea1b62ae96bfec3; sessions.list observed sessionCreated=true, thinkingLevel=high, thinkingOverridePersisted=true; child reasoning=high
omitted:   head=0f516fbdab32c97978473de00ea1b62ae96bfec3; sessions.list observed sessionCreated=true, thinkingLevel=null, thinkingOverridePersisted=false; child reasoning=medium
corrected: head=0f516fbdab32c97978473de00ea1b62ae96bfec3; first call returned the production visible=true validation error; second call persisted thinkingLevel=high; child reasoning=high
invalid:   head=0f516fbdab32c97978473de00ea1b62ae96bfec3; production validation returned Invalid thinking level; sessionCreated=false

The production CLI proof was run on the PR head. On the unmodified pinned base, the focused test reports every unsupported visible parameter in one error passed and its expected error confirms visible thinking was unsupported there.

  • Focused agents regressions: 111 tests passed across 3 files.
  • Focused Gateway server tests: 9 tests passed across 2 files.
  • pnpm prompt:snapshots:check: current, 6 snapshot files.
  • Pinned-base negative control: 1 test passed, 78 skipped.
negative-control: base d777ae1239625a8cadb3da17e7a057d0c4de71fa rejects visible thinking as unsupported
expected base error: thinking: thinking overrides are not wired to the sessions.create path
result: 1 passed | 78 skipped; production exact-HEAD CLI runs above show the accepted persisted value and unchanged omitted default

AI-assisted: built with Codex

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Sep 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR allows explicit thinking levels when spawning visible child sessions while preserving Gateway defaults when thinking is omitted.

Example: An agent calls sessions_spawn with visible=true and thinking="HIGH".

  • Before: The visible-session adapter rejects thinking as unsupported.
  • After: The adapter normalizes the value to "high" and forwards it for persistence before the child's first turn.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The production change is focused, but readiness is limited by fixture-only proof, unresolved product direction, retained polling, redundant tests, and unattributed CI failures.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: An orchestrator cannot select a visible child's thinking level before its first turn begins.
Reason: The implementation covers the requested explicit control, but changes a documented restriction without recorded approval of the product direction.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open: current main still lacks this capability, and maintainer discussion explicitly preserves its separate review; product approval remains unresolved.

Priority: P3
Reviewed head: 4b9522b769b38beb3bfacb4f4f2b5783cb97153e
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should visible sessions_spawn accept explicit thinking overrides while omitted values retain Gateway defaults?
  • Recommendation: Approve explicit creation-time control: Permit explicit supported levels through sessions.create and preserve existing defaults on omission.
  • Why: The existing restriction is intentional and documented, and the maintainer comment preserves a separate decision without approving this extension.

Before merge

  • Add real behavior proof - The exact-head trace exercises chat.send, the shipped spawn tool, Gateway persistence, and child reasoning requests inside Vitest with deterministic provider responses; the separate Gateway fixture mocks agent execution. Add terminal capture or logs from a separate shipped Gateway/CLI run showing explicit high, omitted defaults, corrected retry, and invalid rejection; redact IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Await child-request completion without polling (P3) - The earlier finding remains: this new test polls childRequests for up to 30 seconds using real timers. Root AGENTS.md and the test-writing guide prohibit added polling; the HTTP responder already observes each expected child request and can resolve a completion promise directly. Await that producer-owned signal so incomplete runs do not consume the polling budget.
  • Complete next step - Resolve GitHub's reported merge conflict and diagnose the failed lint, test-type, and agent-flow checks, repairing only failures attributable to this branch.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P3] Await child-request completion without polling — test/pr135296-visible-thinking-runtime.e2e.test.ts:392-394

Tests

  • Low-value test src/agents/tools/sessions-spawn-visible-thinking.test-support.ts: Remove the unchanged permission-forwarding matrix and consolidate repeated omission cases into one case covering requester, saved, and configured thinking.
  • Low-value test src/agents/tool-description-presets.test.ts: Remove the added exact-wording assertion; regenerated prompt snapshots already cover the changed description.
  • Missing end-to-end proof: A separate shipped-entry-point run is missing, and no supplied base-fails/head-passes execution establishes regression discrimination.
Agent review details

How this fits together

The sessions_spawn tool passes visible-child requests through the visible adapter to Gateway session creation, which validates and persists preferences before starting the child agent.

flowchart LR
  A[Agent tool call] --> B[sessions_spawn]
  B --> C[Visible spawn adapter]
  C --> D[Thinking normalization]
  D --> E[Gateway sessions.create]
  E --> F[Persisted session]
  F --> G[Child agent turn]
Loading

Technical review

Best possible solution:

If approved, forward normalized explicit thinking through the existing session-creation owner while preserving omitted-value defaults.

Do we have a high-confidence way to reproduce the issue?

Current-main source explicitly rejects visible thinking overrides, consistent with the documented restriction; no runtime reproduction was performed.

Is this the best way to solve the issue?

Creation-time forwarding uses the correct persistence boundary and avoids changing thinking after the first turn starts, subject to approval of the explicit-only behavior.

Full review comments:

  • [P3] Await child-request completion without polling — test/pr135296-visible-thinking-runtime.e2e.test.ts:392-394
    The earlier finding remains: this new test polls childRequests for up to 30 seconds using real timers. Root AGENTS.md and the test-writing guide prohibit added polling; the HTTP responder already observes each expected child request and can resolve a completion promise directly. Await that producer-owned signal so incomplete runs do not consume the polling budget.
    Confidence: 0.99

Overall correctness: patch is correct
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6c533f67f6ee.

Provenance checked

  • Visible-spawn thinking restriction changes intended behavior with a stated reason (e905a68: Session self-service introduced the visible path; the later parity and constraint-documentation changes retained thinking as unwired to sessions.create.)
  • Thinking defaults documentation keeps the original intent (f024e67: The shared thinking-policy change documented native default precedence; this PR clarifies the existing visible-path exception while adding explicit control.)
  • Prompt snapshots and tool guidance changes intended behavior with a stated reason (163a6c6: Constraint guidance prevented repeated rejected calls; this PR updates that guidance to match its expanded accepted input.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 163a6c6 adds src/agents/tools/sessions-spawn-visible.ts:118 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 163a6c6e169e; files: src/agents/tools/sessions-spawn-visible.ts)
  • Ayaan Zaidi: Raw commit 5f17f89 adds src/agents/tools/sessions-spawn-visible.ts:321 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 5f17f893af58; files: src/agents/tools/sessions-spawn-visible.ts)

PR surface

Source +32, Tests +1182, Docs 0, Other -1. Total +1213 across 21 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 6 40 8 +32
Tests 13 1219 37 +1182
Docs 1 3 3 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 21 1262 49 +1213

Review metrics

Metric Value Why it matters
Production versus test growth Production +30/-8 lines; tests/support +1199/-7 lines, excluding snapshots. Creation-boundary coverage is useful, but repeated omission cases, unchanged permission forwarding, and wording assertions add avoidable test cost.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #134530
Summary: The linked feature issue owns explicit creation-time overrides; configured inheritance and existing-session patch permissions are separate work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This extends an intentionally restricted mode with optional reasoning control; no urgent broken supported workflow is established.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (50 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-29T14:08:13.635Z sha 36888e038298399f6272950795f1c0f597490026 :: needs changes before merge. :: [P3] Qualify the Defaults summary for hidden spawns
  • reviewed 2026-09-30T04:22:01.984Z sha c1dce623793a8a52bf40f0c3f1fc3f2bb61272c8 :: needs changes before merge. :: [P3] Qualify the Defaults summary for hidden spawns
  • reviewed 2026-10-01T15:28:16.027Z sha aaab9e5119441f927b703ae2b9bc572364896b96 :: needs changes before merge. :: [P3] Qualify the Defaults summary for hidden spawns
  • reviewed 2026-10-08T04:14:25.716Z sha 7ba66c23bdd1fdc0873bea8b7d477ab9d56658c2 :: blocked before merge. :: [P3] Qualify the Defaults thinking summary for hidden spawns
  • reviewed 2026-10-09T09:14:44.451Z sha 56001b7b9105927842e6a7aa853c4624c2d86c94 :: blocked before merge. :: [P3] [P3] Scope the thinking Defaults summary to hidden native spawns | [P3] [P3] Update the thinking parameter reference for visible sessions
  • reviewed 2026-10-10T17:39:38.019Z sha 88e105ba10367c802f091bf3b3cb823d81ede4b3 :: needs real behavior proof before merge. :: [P2] Preserve thinking in corrected visible-spawn calls
  • reviewed 2026-10-11T04:16:19.224Z sha 6d8608fee9bbef8f60cf79cf5514e03597307ced :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-13T05:41:37.226Z sha 4b9522b769b38beb3bfacb4f4f2b5783cb97153e :: needs real behavior proof before merge. :: [P3] Await child-request completion without polling

Reviewed October 18, 2026, 6:33 AM ET / 10:33 UTC (Revision 51).

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 Sep 1, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-134530 branch from 8325263 to 16842f9 Compare September 3, 2026 06:12
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-134530 branch from 16842f9 to f7a7cea Compare September 3, 2026 09:24
@clawsweeper clawsweeper Bot removed P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Sep 3, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-134530 branch from b2ddc5c to fe5706f Compare September 9, 2026 08:04
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 9, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-134530 branch from fe5706f to 31b33df Compare September 9, 2026 12:47
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-134530 branch from 31b33df to 1dc77a6 Compare September 9, 2026 23:12
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 9, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-134530 branch from 1dc77a6 to 267a87f Compare September 10, 2026 03:07
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 10, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-134530 branch from 267a87f to 87f1e88 Compare September 10, 2026 13:08
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@VACInc

VACInc commented Sep 12, 2026

Copy link
Copy Markdown
Member

Related, but not superseded by merged #146343. That change adjusts authorization for patches to an existing session; it does not add explicit thinking support to sessions_spawn(visible=true) or forward that input during child creation.

Explicit-input validation and omitted-value/default-preservation behavior are separate creation-time concerns. This PR requires its own review and merge decision.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Thanks @sunlit-deng for the work and validation. Closing under the current scope decision: users can already change a visible session's thinking level with /think high, the effort picker, or sessions(action="patch", sessionKey="…", thinkingLevel="high"). #146343 (landed commit) enabled write-scoped changes; current main retains the settings-tool forwarding, model-supported-level validation, and documented session directives.

The explicit override before a visible child's first turn remains a distinct feature, as the earlier comment notes; #146343 did not implement that spawn flag. We are choosing the existing session-settings surface for this request rather than extending creation-time inputs. The PR's explicit-only validation and omitted-default preservation are useful requirements if that separate feature is revisited. Contributor code was read, not run.

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

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: allow thinking overrides on visible sessions_spawn

3 participants