Skip to content

fix(control-ui): show effective thinking default in session settings#63418

Open
jpreagan wants to merge 7 commits intoopenclaw:mainfrom
jpreagan:fix/control-ui-thinking-default
Open

fix(control-ui): show effective thinking default in session settings#63418
jpreagan wants to merge 7 commits intoopenclaw:mainfrom
jpreagan:fix/control-ui-thinking-default

Conversation

@jpreagan
Copy link
Copy Markdown
Contributor

@jpreagan jpreagan commented Apr 8, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: the Control UI thinking dropdown labeled the default option from a frontend model heuristic instead of the session's effective configured default.
  • Why it matters: sessions could show Default (low) or Default (off) even when runtime resolution was using a configured global or per-agent default such as high.
  • What changed: the gateway now includes effectiveThinkingDefault on each session row, sessions.list passes the gateway model catalog through when deriving that field, and session-row resolution now preserves per-agent thinkingDefault precedence before falling back to model/global defaults.
  • What did NOT change (scope boundary): this does not change actual thinking behavior, session override persistence, or model-default resolution logic outside the displayed Control UI label and session metadata payload.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes # N/A
  • Related # N/A
  • This PR fixes a bug or regression

Root Cause (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause: the Control UI derived Default (...) from a frontend model heuristic instead of consuming the active session's effective configured default from backend session/config state.
  • Missing detection / guardrail: there was no focused coverage for catalog-dependent reasoning defaults or for non-default agents with their own thinkingDefault.
  • Contributing context (if known): the session row originally carried only the explicit override (thinkingLevel), not the separately resolved effective default.

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/gateway/session-utils.test.ts, src/gateway/server.sessions.gateway-server-sessions-a.test.ts, ui/src/ui/views/chat.test.ts
  • Scenario the test should lock in: configured global defaults, catalog-backed reasoning defaults, and per-agent thinkingDefault overrides should all produce the same Default (...) label the runtime uses for the active session.
  • Why this is the smallest reliable guardrail: the bug crosses the gateway session payload seam, model-catalog resolution, per-agent config precedence, and the Control UI render path.
  • Existing test that already covers this (if any): None before this PR.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

The Control UI thinking dropdown now shows the actual effective default for the active session, including global configured defaults, catalog-backed reasoning defaults, and per-agent thinkingDefault overrides, instead of stale heuristic values such as low or off.

Diagram (if applicable)

Before:
[open session settings] -> [session row has only thinkingLevel override]
-> [UI recomputes default from heuristic] -> [Default (low/off)]

After:
[open session settings] -> [session row includes effectiveThinkingDefault]
-> [gateway resolves catalog + config precedence] -> [Default (high/minimal/etc.)]

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local dev branch build via pnpm build and pnpm openclaw gateway run --bind loopback --port 18789 --force
  • Model/provider: live local Control UI session on openai-codex/gpt-5.4
  • Integration/channel (if any): Control UI session settings
  • Relevant config (redacted): agents.defaults.thinkingDefault: high

Steps

  1. Configure agents.defaults.thinkingDefault or an agent-specific agents.list[].thinkingDefault.
  2. Open the Control UI for the active session and inspect the thinking dropdown label.
  3. Compare the label against the runtime chat.history / session payload from the running gateway.

Expected

  • The dropdown shows the same effective default that runtime session resolution uses.

Actual

  • Before this change, the dropdown could show heuristic values like Default (low) or Default (off) even while runtime resolution used a configured higher default.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: ran pnpm test src/gateway/session-utils.test.ts src/gateway/server.sessions.gateway-server-sessions-a.test.ts ui/src/ui/views/chat.test.ts; rebuilt with pnpm build; restarted the local branch-run gateway; verified via direct RPC that sessions.list returned effectiveThinkingDefault: "high" and chat.history returned thinkingLevel: "high"; manually verified the Control UI rendered Default (high) after refresh.
  • Edge cases checked: confirmed catalog-backed reasoning defaults are used when available; confirmed effectiveThinkingDefault stays unset when the backend cannot resolve it safely; confirmed per-agent thinkingDefault takes precedence in session-row defaults.
  • What you did not verify: full pnpm test, non-Control-UI surfaces, or provider-specific behavior beyond the reproduced live local session.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: older gateways that do not return effectiveThinkingDefault would otherwise lose the label.
    • Mitigation: the Control UI keeps the existing model-heuristic fallback when the new field is absent.
  • Risk: session-list metadata could drift from runtime thinking precedence again if config/catalog resolution changes in only one path.
    • Mitigation: the PR adds focused gateway helper, handler, and UI coverage for catalog-backed and per-agent default cases.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: S labels Apr 8, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 8, 2026

Greptile Summary

This PR fixes the Control UI thinking dropdown showing a stale model-heuristic label (e.g. Default (low)) instead of the backend-resolved configured default (e.g. Default (high)). The gateway now computes and surfaces effectiveThinkingDefault on each GatewaySessionRow — prioritising agents.defaults.thinkingDefault from the agent config and falling back to the existing model heuristic — and the Control UI consumes that field before falling back to its own resolveThinkingDefaultForModel call, preserving compatibility with older gateways. Types are updated on both sides, and the fix is covered by new targeted tests in session-utils.test.ts and chat.test.ts.

Confidence Score: 5/5

Safe to merge — narrow, backward-compatible fix with targeted tests and no logic changes outside the displayed label.

All findings are P2 or lower. The gateway computation, UI fallback, type updates, and new tests are all consistent and correct. Older gateways that omit the field naturally fall back to the existing heuristic.

No files require special attention.

Vulnerabilities

No security concerns identified. The change only adds a derived, read-only metadata field (effectiveThinkingDefault) to the session list payload; no auth, secrets, or data-access scope is altered.

Reviews (1): Last reviewed commit: "show effective thinking default" | Re-trigger Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 577784046c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/session-utils.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f35ce2c62

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/session-utils.ts Outdated
@jpreagan
Copy link
Copy Markdown
Contributor Author

jpreagan commented Apr 8, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jpreagan jpreagan force-pushed the fix/control-ui-thinking-default branch from bd14b7e to e58c321 Compare April 11, 2026 19:10
@jpreagan
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jpreagan
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce2f24aafd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/session-utils.ts Outdated
@jpreagan
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Labels

app: web-ui App: web-ui gateway Gateway runtime size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant