Skip to content

fix(status): merge per-agent thinkingDefault into status display - #53850

Closed
ysfbsf wants to merge 2 commits into
openclaw:mainfrom
ysfbsf:fix/per-agent-thinking-default-status-display
Closed

ysfbsf wants to merge 2 commits into
openclaw:mainfrom
ysfbsf:fix/per-agent-thinking-default-status-display

Conversation

@ysfbsf

@ysfbsf ysfbsf commented Mar 24, 2026

Copy link
Copy Markdown

Summary

  • /status command and session_status tool now respect per-agent thinkingDefault, verboseDefault, and elevatedDefault from agents.list[] entries
  • Previously these values were only read from agents.defaults, causing the status to show "Think: off" even when a per-agent override was correctly configured and applied to API calls

Change Type

  • Bug fix

Scope

  • Gateway

Linked Issue/PR

Closes #53826
Related: #21097, #28041, #26909

Root Cause

Both commands-status.ts and session-status-tool.ts construct the agent object for buildStatusMessage() using only cfg.agents?.defaults:

const agentDefaults = cfg.agents?.defaults ?? {};
// ...
thinkingDefault: agentDefaults.thinkingDefault,  // ← misses per-agent override

Meanwhile the actual reply flow in model-selection.ts correctly resolves per-agent config via resolveAgentConfig() and checks agentEntry?.thinkingDefault first.

Fix

Resolve the per-agent config via resolveAgentConfig() in both callers and prefer per-agent values over global defaults:

const agentEntry = resolveAgentConfig(cfg, agentId);
// ...
thinkingDefault: agentEntry?.thinkingDefault ?? agentDefaults.thinkingDefault,

Files Changed

  • src/auto-reply/reply/commands-status.ts — /status command
  • src/agents/tools/session-status-tool.ts — session_status tool

Security Impact

  • 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

Testing

  • corepack pnpm exec vitest run src/agents/openclaw-tools.session-status.test.ts — 15/15 pass
  • corepack pnpm exec vitest run src/auto-reply/status.test.ts — 40/42 pass (2 pre-existing failures unrelated to this change)
  • Type-check clean on changed files (tsc --noEmit reports no errors in either file)

Repro + Verification

  1. Configure per-agent thinkingDefault:
{
  "agents": {
    "list": [{
      "id": "kira",
      "model": "openai-codex/gpt-5.4",
      "thinkingDefault": "xhigh"
    }]
  }
}
  1. Before fix: /status shows "Think: off"
  2. After fix: /status shows "Think: xhigh"

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

The /status command and session_status tool only read from
agents.defaults when building the status card, ignoring per-agent
thinkingDefault/verboseDefault/elevatedDefault overrides from
agents.list[] entries. This causes the status to show "Think: off"
even when a per-agent thinkingDefault is correctly configured and
applied to API calls.

Resolve the per-agent config via resolveAgentConfig() and prefer its
values over global defaults when passing to buildStatusMessage().

Closes openclaw#53826
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Mar 24, 2026
@greptile-apps

greptile-apps Bot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the /status command and session_status tool so they correctly reflect per-agent thinkingDefault, verboseDefault, and elevatedDefault overrides instead of always falling back to cfg.agents.defaults. The approach — calling resolveAgentConfig() and preferring the per-agent entry — is correct in principle, and the thinkingDefault part of the fix works as intended.

However, the verboseDefault and elevatedDefault portions of the fix are silently broken:

  • resolveAgentConfig() in src/agents/agent-scope.ts returns a ResolvedAgentConfig object that does not include verboseDefault or elevatedDefault — neither in the type definition nor in the constructed return value.
  • As a result, agentEntry?.verboseDefault and agentEntry?.elevatedDefault always evaluate to undefined at runtime in both changed files, so those lines always fall through to agentDefaults.verboseDefault / agentDefaults.elevatedDefault.
  • The per-agent override for verboseDefault and elevatedDefault remains unfixed despite the PR's stated intent. This affects both src/auto-reply/reply/commands-status.ts (lines 230–231) and src/agents/tools/session-status-tool.ts (lines 487–488).

The fix requires adding verboseDefault and elevatedDefault to ResolvedAgentConfig and populating them in the resolveAgentConfig() return object in agent-scope.ts.

Confidence Score: 3/5

  • Safe to merge only if the thinkingDefault fix is the only intended change; merging as-is silently leaves verboseDefault and elevatedDefault per-agent overrides broken in the status display.
  • thinkingDefault is fixed correctly and matches the PR title. But the PR description and implementation also claim to fix verboseDefault and elevatedDefault, and those fixes are silently no-ops because resolveAgentConfig() doesn't return those fields. The incomplete fix means two-thirds of the stated bug scope remains unresolved without any runtime error or test failure to surface it.
  • src/agents/agent-scope.ts needs verboseDefault and elevatedDefault added to ResolvedAgentConfig and its return value before the verboseDefault/elevatedDefault overrides in the two changed files can take effect.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/commands-status.ts
Line: 230-231

Comment:
**`verboseDefault`/`elevatedDefault` always `undefined` from `agentEntry`**

`resolveAgentConfig()` returns a `ResolvedAgentConfig` object that explicitly omits both `verboseDefault` and `elevatedDefault` — neither field is in the `ResolvedAgentConfig` type definition nor in the constructed return value in `agent-scope.ts`:

```ts
// agent-scope.ts — returned object (lines 130–150)
return {
  thinkingDefault: entry.thinkingDefault,   // ✅ present
  // verboseDefault is never set here
  // elevatedDefault is never set here
};
```

As a result, `agentEntry?.verboseDefault` and `agentEntry?.elevatedDefault` will always be `undefined` at runtime, so both lines always fall through to `agentDefaults.verboseDefault` / `agentDefaults.elevatedDefault`. The per-agent override is silently ignored for these two fields — the same root-cause bug the PR aims to fix for `thinkingDefault`.

To complete the fix, `verboseDefault` and `elevatedDefault` need to be added to the `ResolvedAgentConfig` type and populated in `resolveAgentConfig()`:

```ts
// agent-scope.ts — ResolvedAgentConfig type
type ResolvedAgentConfig = {
  // ...existing fields...
  thinkingDefault?: AgentEntry["thinkingDefault"];
  verboseDefault?: AgentEntry["verboseDefault"];   // add
  elevatedDefault?: AgentEntry["elevatedDefault"]; // add
};

// resolveAgentConfig() return object
return {
  // ...existing fields...
  thinkingDefault: entry.thinkingDefault,
  verboseDefault: entry.verboseDefault,   // add
  elevatedDefault: entry.elevatedDefault, // add
};
```

The same issue exists in `src/agents/tools/session-status-tool.ts` at lines 487–488.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(status): merge per-agent thinkingDef..." | Re-trigger Greptile

Comment thread src/auto-reply/reply/commands-status.ts Outdated
Comment on lines +230 to +231
verboseDefault: agentEntry?.verboseDefault ?? agentDefaults.verboseDefault,
elevatedDefault: agentEntry?.elevatedDefault ?? agentDefaults.elevatedDefault,

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.

P1 verboseDefault/elevatedDefault always undefined from agentEntry

resolveAgentConfig() returns a ResolvedAgentConfig object that explicitly omits both verboseDefault and elevatedDefault — neither field is in the ResolvedAgentConfig type definition nor in the constructed return value in agent-scope.ts:

// agent-scope.ts — returned object (lines 130–150)
return {
  thinkingDefault: entry.thinkingDefault,   // ✅ present
  // verboseDefault is never set here
  // elevatedDefault is never set here
};

As a result, agentEntry?.verboseDefault and agentEntry?.elevatedDefault will always be undefined at runtime, so both lines always fall through to agentDefaults.verboseDefault / agentDefaults.elevatedDefault. The per-agent override is silently ignored for these two fields — the same root-cause bug the PR aims to fix for thinkingDefault.

To complete the fix, verboseDefault and elevatedDefault need to be added to the ResolvedAgentConfig type and populated in resolveAgentConfig():

// agent-scope.ts — ResolvedAgentConfig type
type ResolvedAgentConfig = {
  // ...existing fields...
  thinkingDefault?: AgentEntry["thinkingDefault"];
  verboseDefault?: AgentEntry["verboseDefault"];   // add
  elevatedDefault?: AgentEntry["elevatedDefault"]; // add
};

// resolveAgentConfig() return object
return {
  // ...existing fields...
  thinkingDefault: entry.thinkingDefault,
  verboseDefault: entry.verboseDefault,   // add
  elevatedDefault: entry.elevatedDefault, // add
};

The same issue exists in src/agents/tools/session-status-tool.ts at lines 487–488.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/commands-status.ts
Line: 230-231

Comment:
**`verboseDefault`/`elevatedDefault` always `undefined` from `agentEntry`**

`resolveAgentConfig()` returns a `ResolvedAgentConfig` object that explicitly omits both `verboseDefault` and `elevatedDefault` — neither field is in the `ResolvedAgentConfig` type definition nor in the constructed return value in `agent-scope.ts`:

```ts
// agent-scope.ts — returned object (lines 130–150)
return {
  thinkingDefault: entry.thinkingDefault,   // ✅ present
  // verboseDefault is never set here
  // elevatedDefault is never set here
};
```

As a result, `agentEntry?.verboseDefault` and `agentEntry?.elevatedDefault` will always be `undefined` at runtime, so both lines always fall through to `agentDefaults.verboseDefault` / `agentDefaults.elevatedDefault`. The per-agent override is silently ignored for these two fields — the same root-cause bug the PR aims to fix for `thinkingDefault`.

To complete the fix, `verboseDefault` and `elevatedDefault` need to be added to the `ResolvedAgentConfig` type and populated in `resolveAgentConfig()`:

```ts
// agent-scope.ts — ResolvedAgentConfig type
type ResolvedAgentConfig = {
  // ...existing fields...
  thinkingDefault?: AgentEntry["thinkingDefault"];
  verboseDefault?: AgentEntry["verboseDefault"];   // add
  elevatedDefault?: AgentEntry["elevatedDefault"]; // add
};

// resolveAgentConfig() return object
return {
  // ...existing fields...
  thinkingDefault: entry.thinkingDefault,
  verboseDefault: entry.verboseDefault,   // add
  elevatedDefault: entry.elevatedDefault, // add
};
```

The same issue exists in `src/agents/tools/session-status-tool.ts` at lines 487–488.

How can I resolve this? If you propose a fix, please make it concise.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b92207b11a

ℹ️ 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/auto-reply/reply/commands-status.ts Resolved
verboseDefault and elevatedDefault don't exist on per-agent config
(AgentConfig type) — they're only on AgentDefaultsConfig. The
resolveAgentConfig() return type doesn't include them either, so
the override was always a no-op. Keep those on agentDefaults only.
@ysfbsf

ysfbsf commented Mar 24, 2026

Copy link
Copy Markdown
Author

CI note: The check job fails on format:check (oxfmt) due to test/fixtures/test-memory-hotspots.unit.json — this is a pre-existing issue on main, not caused by this PR. The file was last modified in af9de86 and the format check passes locally with oxfmt 0.41.0 but fails in CI (which uses a different pnpm/oxfmt version). This will affect all PRs branching from current HEAD.

The actual code changes (2 files: commands-status.ts and session-status-tool.ts) have no formatting issues.

@scoootscooob

Copy link
Copy Markdown
Member

Thanks for the earlier per-agent thinkingDefault fix here.

I folded the overlapping status-display work from #53850 into #55425 and added Co-authored-by credit so the consolidated branch preserves attribution when it lands.

I’m consolidating on #55425 so the runtime-model fix and the per-agent thinking fix land together in one path, along with the follow-up review correction on the session_status fallback logic.

PR: #55425

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

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-agent thinkingDefault ignored in /status and session_status display

2 participants