Skip to content

fix: /status shows stale thinking level after directive change#16700

Open
cmfinlan wants to merge 5 commits intoopenclaw:mainfrom
cmfinlan:fix/status-think-level-10867
Open

fix: /status shows stale thinking level after directive change#16700
cmfinlan wants to merge 5 commits intoopenclaw:mainfrom
cmfinlan:fix/status-think-level-10867

Conversation

@cmfinlan
Copy link

@cmfinlan cmfinlan commented Feb 15, 2026

Problem

When /think high /status (or any /think X /status combo) is sent as a directive-only message, the Think: field in the status reply shows the old thinking level rather than the just-applied one.

Root cause

In get-reply-directives-apply.ts, resolvedDefaultThinkLevel is computed before handleDirectiveOnly runs. handleDirectiveOnly mutates sessionEntry.thinkingLevel to the new value, but the status reply still receives the stale pre-directive value.

Fix

After handleDirectiveOnly returns, re-resolve all directive levels from sessionEntry before passing them to buildStatusReply. This ensures the status output reflects the just-applied changes.

The same pattern is applied to verbose, reasoning, and elevated levels for consistency.

Tests

Added two regression tests to status.test.ts:

  • Verifies resolvedThink matching the updated sessionEntry.thinkingLevel shows correctly
  • Verifies sessionEntry.thinkingLevel fallback works when resolvedThink is omitted

All 28 tests pass.

Closes #10867

Greptile Summary

Fixes a stale status display bug where /think high /status (or any /directive /status combo) showed the old thinking level instead of the just-applied one. The fix re-resolves all directive levels (thinkingLevel, verboseLevel, reasoningLevel, elevatedLevel) from sessionEntry after handleDirectiveOnly mutates them, ensuring the status output reflects the current state.

Key changes:

  • get-reply-directives-apply.ts: Re-reads directive levels from sessionEntry after handleDirectiveOnly completes before passing to buildStatusReply
  • status.ts: Updated fallback chain to check sessionEntry levels when resolved* params are omitted
  • session-status-tool.ts: Now explicitly resolves and passes all directive levels to buildStatusMessage
  • Added comprehensive regression tests covering fallback behavior and the specific bug scenario
  • Unrelated fix: gateway-lock.test.ts switched from fake timers to real timers to avoid intermittent CI hangs

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix correctly addresses the root cause by re-resolving directive levels after mutation. The implementation follows existing patterns, includes comprehensive regression tests (8 new test cases covering fallback chains and the bug scenario), and all 28 tests pass. The logic is straightforward with no edge cases or security concerns.
  • No files require special attention

Last reviewed commit: 1516698

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

reasoningLevel: "medium",
},
sessionKey: "agent:main:main",
sessionScope: "per-sender",
Copy link
Contributor

Choose a reason for hiding this comment

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

Invalid ReasoningLevel value in test

ReasoningLevel is defined as "off" | "on" | "stream", but this test uses "medium" which is not a valid value. The test still passes because SessionEntry.reasoningLevel is typed as string | undefined, but using an invalid value here weakens the test's fidelity — it's testing a scenario that shouldn't occur in practice. Consider using "on" or "stream" instead.

Suggested change
sessionScope: "per-sender",
reasoningLevel: "on",
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/status.test.ts
Line: 129:129

Comment:
**Invalid `ReasoningLevel` value in test**

`ReasoningLevel` is defined as `"off" | "on" | "stream"`, but this test uses `"medium"` which is not a valid value. The test still passes because `SessionEntry.reasoningLevel` is typed as `string | undefined`, but using an invalid value here weakens the test's fidelity — it's testing a scenario that shouldn't occur in practice. Consider using `"on"` or `"stream"` instead.

```suggestion
        reasoningLevel: "on",
```

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

Christopher Finlan added 3 commits February 15, 2026 13:48
…sion entry

The `buildStatusMessage` function had an inconsistency: it checked
`sessionEntry.elevatedLevel` as a fallback but did NOT check
`sessionEntry.thinkingLevel`, `sessionEntry.verboseLevel`, or
`sessionEntry.reasoningLevel`. This caused the `session_status` tool
(and any other caller that omits the pre-resolved values) to show the
config default instead of the session's actual thinking level.

Changes:
- `buildStatusMessage` (status.ts): Add sessionEntry fallback for
  thinkLevel, verboseLevel, and reasoningLevel — matching the existing
  elevatedLevel pattern.
- `session_status` tool (session-status-tool.ts): Explicitly resolve
  and pass resolvedThink/Verbose/Reasoning/Elevated to
  buildStatusMessage, mirroring the resolution chain used by the
  runtime header builder.
- Add 5 regression tests covering the fallback chain priority.

Fixes openclaw#10867
…law#10867)

When /think X /status are sent together as a directive-only message,
buildStatusReply received the pre-directive resolvedDefaultThinkLevel
which was computed before handleDirectiveOnly mutated sessionEntry.

Re-resolve all directive levels from sessionEntry after handleDirectiveOnly
runs so the status reply reflects the just-applied changes.

Also re-resolve verbose, reasoning, and elevated levels for consistency.

Closes openclaw#10867
ReasoningLevel type is 'off' | 'on' | 'stream', not ThinkLevel.
Addresses Greptile review comment on status.test.ts:129.
@cmfinlan cmfinlan force-pushed the fix/status-think-level-10867 branch from be52090 to 8ce32fb Compare February 15, 2026 21:49
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: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thinking Level Inconsistencies in session_status Display

2 participants

Comments