Skip to content

fix: sessions model default does not clear the override - #159587

Merged
obviyus merged 2 commits into
mainfrom
fix/sessions-patch-model-default-159538
Sep 27, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/sessions-patch-model-default-159538

Conversation

@obviyus

@obviyus obviyus commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #159538

What Problem This Solves

Fixes the sessions tool treating model: "default" as a literal model name instead of clearing the session's model override.

User Impact

Agents can return a session to its configured model with sessions action=patch model=default, consistently with /model default and session_status model=default. No configuration, tool-schema, description, or public API changes.

Why This Change Was Made

Reuse the existing tool model-override normalizer and send the Gateway's existing null reset value. Explicit model ids and thinking-level patches keep their existing behavior.

The Gateway's post-commit selection refresh also handles null resets, so an already queued follow-up does not retain the old override.

Evidence

Real isolated, freshly built Gateways with a scripted OpenAI Responses provider called the actual sessions tool through its advertised tool_call entry point:

Scenario Before After
default, no model allowlist Stored mock-openai/default; next provider request used default Override cleared; next request used configured model
default, configured allowlist Rejected mock-openai/default; old override remained Override cleared; next request used configured model
Normal model id Selected requested model Unchanged
/model default Cleared override Unchanged
session_status model=default Cleared override Unchanged
Unknown model id with allowlist Rejected; old override retained Unchanged

The scripted provider responds to all requested model names, so the no-allowlist proof demonstrates the wrong next-turn model request, not an upstream-provider failure. Without an allowlist, unknown ids remain accepted as before.

The reset regression failed on the original implementation (default instead of null) and passes with the fix. Focused sessions-tool suite: 33 passing tests; response suite after moving the regression to avoid the existing file's line cap: 6 passing tests, 17.68s wall, regression 7ms. Touched-file type-aware lint/type checking and formatting passed. Both fresh builds completed; both reported existing Control UI size warnings, unrelated to this change.

Pending-turn proof: held the current scripted provider response, submitted a follow-up, observed pendingInputs.queuedCount > 0, then released the response that calls sessions action=patch model=default. Before the queue-owner fix, the tool reported updated and the stored model was configured, but the queued provider request still used override. Afterward, that queued request used configured. A queued session_status model=default control also used configured. The baseline run completed the sessions case; its subsequent status-control setup encountered a transient session-access readiness error. The candidate completed both cases.

The real queue-state regression failed before the queue-owner fix and passed afterward (630ms); all 29 queue-state sibling tests passed (32.22s combined wall). Scoped type-aware lint/type checking passed for the queue owner and regression.

@clawsweeper

clawsweeper Bot commented Sep 27, 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.

@obviyus
obviyus marked this pull request as ready for review September 27, 2026 10:09
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Sep 27, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 6:50 AM ET / 10:50 UTC (Revision 2).

ClawSweeper review

What this changes

The branch makes the agent’s sessions tool clear a model override when asked for “default” and refreshes queued follow-ups to use the configured model after the Gateway commits the reset.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for the normal merge path. Current main still has the reported defect, while the current head addresses the earlier queued-follow-up finding and the PR body records real Gateway before-and-after observations. No blocking patch finding remains.

Priority: P1
Reviewed head: 0d2e991d877c9db4a13a18d8ea2028e46388d428

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused fix has relevant real Gateway before-and-after observations and distinct regressions for tool mapping and queued selection.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The changed agent-tool parser and Gateway queue refresh were exercised through real isolated Gateways with a scripted OpenAI Responses provider. The captured before-and-after observations show the next request and an already queued follow-up using the configured model after reset. No stored data-model contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The changed agent-tool parser and Gateway queue refresh were exercised through real isolated Gateways with a scripted OpenAI Responses provider. The captured before-and-after observations show the next request and an already queued follow-up using the configured model after reset. No stored data-model contract changes.
Evidence reviewed 8 items Agent tool change: The introduced parser maps the existing “default” sentinel to the Gateway’s null model-reset value while retaining required string input for concrete models.
Queued selection change: The introduced condition allows a null model patch through the existing post-commit queued-selection refresh.
Commit boundary: The Gateway calls the refresh after an applied session patch, using the committed entry.
Findings None None.
Security None None.

How this fits together

The agent’s sessions tool sends model changes to the Gateway, which stores the session selection. Queued follow-ups carry a model selection into the next provider request, so they must reflect a committed reset.

flowchart LR
A[Agent model request] --> B[Sessions tool]
B --> C[Interpret default]
C --> D[Gateway session patch]
D --> E[Stored session selection]
D --> F[Refresh queued follow-ups]
E --> G[Next provider request]
F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +64. Total +66 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 8 6 +2
Tests 2 64 0 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 72 6 +66

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #159538
Summary: The linked open issue describes the same sessions-tool reset defect; this unmerged PR is its candidate fix.

Members:

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

Technical review

Best possible solution:

Keep the tool’s reset sentinel aligned with the Gateway’s null-reset contract, and ensure queued follow-ups inherit the committed configured model.

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

Yes. The PR records a before-and-after run through the actual sessions tool and Gateway, including the next provider request; current main still contains the behavior exercised in the baseline.

Is this the best way to solve the issue?

Yes. Reusing the tool’s existing model normalizer and the Gateway’s null reset is a narrow fix, and the added post-commit refresh covers the queued-turn failure identified in the prior review.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b505b36c45b3.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The changed agent-tool parser and Gateway queue refresh were exercised through real isolated Gateways with a scripted OpenAI Responses provider. The captured before-and-after observations show the next request and an already queued follow-up using the configured model after reset. No stored data-model contract changes.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The existing bug can leave an agent session requesting a nonexistent model and unable to answer until its owner resets the selection.
  • merge-risk: 🚨 auth-provider: The patch changes which model immediate and queued session turns request; the PR’s real Gateway observations cover both paths.
  • 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 changed agent-tool parser and Gateway queue refresh were exercised through real isolated Gateways with a scripted OpenAI Responses provider. The captured before-and-after observations show the next request and an already queued follow-up using the configured model after reset. No stored data-model contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed agent-tool parser and Gateway queue refresh were exercised through real isolated Gateways with a scripted OpenAI Responses provider. The captured before-and-after observations show the next request and an already queued follow-up using the configured model after reset. No stored data-model contract changes.

Evidence

What I checked:

Likely related people:

  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

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

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-27T10:17:15.095Z sha 5f24c6d :: blocked before merge. :: [P2] Refresh queued follow-ups when clearing the model override

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S and removed size: XS labels Sep 27, 2026
@clawsweeper clawsweeper Bot added 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 27, 2026
@obviyus
obviyus merged commit 4f227c5 into main Sep 27, 2026
198 of 199 checks passed
@obviyus
obviyus deleted the fix/sessions-patch-model-default-159538 branch September 27, 2026 11:16
@obviyus

obviyus commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator Author

Merged as 4f227c5. Thanks @dh-js for the clear report.

The agent sessions tool now treats model: "default" as clearing the session's model override, the same as /model default and session_status. On a real isolated Gateway, main pinned the session to <provider>/default and sent that literal model name on the next turn; with this change the override is cleared and the next turn, including an already-queued follow-up, uses the configured model. Normal model ids, allowlist rejection of unknown ids, and the existing reset paths are unchanged.

vincentkoc added a commit that referenced this pull request Sep 27, 2026
* commit '69809d7a94277d01be964bd1cbbb7aa0ebc58c9b': (219 commits)
  perf(agents): serialize large model requests once (#159574)
  refactor(cli): share capability agent-selection test cases (#159616)
  fix(workers): restore installation type checks (#159629)
  test(channels,qa,providers): remove low-value tests (batch d065) (#159627)
  test(doctor): run isolated migration cases concurrently (#159609)
  feat(apple): show agent identities in native chat (#159528)
  chore(i18n): refresh native locales (#159635)
  fix(gateway): keep node provisioning's installation contract after overlapped preparation
  fix(models): keep shared catalog requests alive for remaining callers (#157191)
  feat: let agents query online people and device activity (#159117)
  perf(gateway): first cloud dispatch prepares worker artifacts one after another (#159520)
  refactor(android): deslop Android app third pass (#159589)
  test(qa-lab,openshell,slack,reef,team-reports): remove low-value tests (batch d064) (#159607)
  fix: align process liveness checks (#151107) thanks @ekinnee
  fix: sessions model default does not clear the override (#159587)
  fix(ios): preserve typing during reentrant SwiftUI updates
  fix(ci): frozen 2026.8.33 validation fails on inherited test clock (#159594)
  perf(gateway): avoid duplicate recipient row lookup (#159595)
  refactor(gateway): deslop gateway fourth pass (#158786)
  test(agents): split subagent task-settlement test support under the line cap (#159584)
  ...
vincentkoc added a commit that referenced this pull request Sep 27, 2026
* commit '69809d7a94277d01be964bd1cbbb7aa0ebc58c9b': (219 commits)
  perf(agents): serialize large model requests once (#159574)
  refactor(cli): share capability agent-selection test cases (#159616)
  fix(workers): restore installation type checks (#159629)
  test(channels,qa,providers): remove low-value tests (batch d065) (#159627)
  test(doctor): run isolated migration cases concurrently (#159609)
  feat(apple): show agent identities in native chat (#159528)
  chore(i18n): refresh native locales (#159635)
  fix(gateway): keep node provisioning's installation contract after overlapped preparation
  fix(models): keep shared catalog requests alive for remaining callers (#157191)
  feat: let agents query online people and device activity (#159117)
  perf(gateway): first cloud dispatch prepares worker artifacts one after another (#159520)
  refactor(android): deslop Android app third pass (#159589)
  test(qa-lab,openshell,slack,reef,team-reports): remove low-value tests (batch d064) (#159607)
  fix: align process liveness checks (#151107) thanks @ekinnee
  fix: sessions model default does not clear the override (#159587)
  fix(ios): preserve typing during reentrant SwiftUI updates
  fix(ci): frozen 2026.8.33 validation fails on inherited test clock (#159594)
  perf(gateway): avoid duplicate recipient row lookup (#159595)
  refactor(gateway): deslop gateway fourth pass (#158786)
  test(agents): split subagent task-settlement test support under the line cap (#159584)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
)

Closes openclaw#159538

## What Problem This Solves

Fixes the `sessions` tool treating `model: "default"` as a literal model name instead of clearing the session's model override.

## User Impact

Agents can return a session to its configured model with `sessions action=patch model=default`, consistently with `/model default` and `session_status model=default`. No configuration, tool-schema, description, or public API changes.

## Why This Change Was Made

Reuse the existing tool model-override normalizer and send the Gateway's existing null reset value. Explicit model ids and thinking-level patches keep their existing behavior.

The Gateway's post-commit selection refresh also handles null resets, so an already queued follow-up does not retain the old override.

No overlap with Pash/Sarah changes.

## Evidence

Real isolated, freshly built Gateways with a scripted OpenAI Responses provider called the actual `sessions` tool through its advertised `tool_call` entry point:

| Scenario | Before | After |
| --- | --- | --- |
| `default`, no model allowlist | Stored `mock-openai/default`; next provider request used `default` | Override cleared; next request used configured model |
| `default`, configured allowlist | Rejected `mock-openai/default`; old override remained | Override cleared; next request used configured model |
| Normal model id | Selected requested model | Unchanged |
| `/model default` | Cleared override | Unchanged |
| `session_status model=default` | Cleared override | Unchanged |
| Unknown model id with allowlist | Rejected; old override retained | Unchanged |

The scripted provider responds to all requested model names, so the no-allowlist proof demonstrates the wrong next-turn model request, not an upstream-provider failure. Without an allowlist, unknown ids remain accepted as before.

The reset regression failed on the original implementation (`default` instead of null) and passes with the fix. Focused sessions-tool suite: 33 passing tests; response suite after moving the regression to avoid the existing file's line cap: 6 passing tests, 17.68s wall, regression 7ms. Touched-file type-aware lint/type checking and formatting passed. Both fresh builds completed; both reported existing Control UI size warnings, unrelated to this change.

Pending-turn proof: held the current scripted provider response, submitted a follow-up, observed `pendingInputs.queuedCount > 0`, then released the response that calls `sessions action=patch model=default`. Before the queue-owner fix, the tool reported `updated` and the stored model was `configured`, but the queued provider request still used `override`. Afterward, that queued request used `configured`. A queued `session_status model=default` control also used `configured`. The baseline run completed the sessions case; its subsequent status-control setup encountered a transient session-access readiness error. The candidate completed both cases.

The real queue-state regression failed before the queue-owner fix and passed afterward (630ms); all 29 queue-state sibling tests passed (32.22s combined wall). Scoped type-aware lint/type checking passed for the queue owner and regression.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

1 participant