fix(session_status): prefer runSessionKey for implicit no-arg lookups · openclaw/openclaw@75a9293
leno23
·
2026-05-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -534,6 +534,35 @@ describe("session_status tool", () => {
|
534 | 534 | expect(details.sessionKey).toBe("main"); |
535 | 535 | }); |
536 | 536 | |
| 537 | +it("uses runSessionKey thinking level for implicit no-arg status lookups (#82669)", async () => { |
| 538 | +resetSessionStore({ |
| 539 | +"agent:main:telegram:default:direct:1234": { |
| 540 | +sessionId: "s-tg-direct", |
| 541 | +updatedAt: 5, |
| 542 | +status: "done", |
| 543 | +thinkingLevel: "off", |
| 544 | +}, |
| 545 | +"agent:main:main": { |
| 546 | +sessionId: "s-main", |
| 547 | +updatedAt: 10, |
| 548 | +status: "running", |
| 549 | +thinkingLevel: "high", |
| 550 | +}, |
| 551 | +}); |
| 552 | + |
| 553 | +const tool = createSessionStatusTool({ |
| 554 | +agentSessionKey: "agent:main:telegram:default:direct:1234", |
| 555 | +runSessionKey: "agent:main:main", |
| 556 | +config: mockConfig as never, |
| 557 | +}); |
| 558 | + |
| 559 | +await tool.execute("call-implicit-run-session-thinking", {}); |
| 560 | + |
| 561 | +const statusArg = mockCallArg(buildStatusMessageMock) as Record<string, unknown>; |
| 562 | +const sessionEntry = statusArg.sessionEntry as SessionEntry; |
| 563 | +expect(sessionEntry.thinkingLevel).toBe("high"); |
| 564 | +}); |
| 565 | + |
537 | 566 | it("resolves sessionKey=current to runSessionKey under default tree visibility (#76708)", async () => { |
538 | 567 | resetSessionStore({ |
539 | 568 | "agent:main:telegram:default:direct:1234": { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -397,12 +397,20 @@ export function createSessionStatusTool(opts?: {
|
397 | 397 | }); |
398 | 398 | |
399 | 399 | const requestedKeyParam = readStringParam(params, "sessionKey"); |
| 400 | +const isImplicitRunSessionStatus = |
| 401 | +requestedKeyParam === undefined && Boolean(opts?.runSessionKey?.trim()); |
400 | 402 | let requestedKeyRaw = requestedKeyParam ?? opts?.agentSessionKey; |
401 | 403 | |
| 404 | +// No-arg status should prefer the live run session when available (#82669). |
| 405 | +if (isImplicitRunSessionStatus) { |
| 406 | +requestedKeyRaw = opts?.runSessionKey; |
| 407 | +} |
| 408 | + |
402 | 409 | // Track whether this is a semantic-current request (literal "current" or a |
403 | 410 | // current-client alias) BEFORE any rewrite, so visibility treats it as self. |
404 | 411 | const isSemanticCurrentRequest = |
405 | 412 | requestedKeyRaw === "current" || |
| 413 | +isImplicitRunSessionStatus || |
406 | 414 | Boolean( |
407 | 415 | resolveCurrentSessionClientAlias({ |
408 | 416 | key: requestedKeyRaw ?? "", |
@@ -558,7 +566,7 @@ export function createSessionStatusTool(opts?: {
|
558 | 566 | const fallback = resolveImplicitCurrentSessionFallback({ |
559 | 567 | allowFallback: isSemanticCurrentRequest || requestedKeyParam === undefined, |
560 | 568 | fallbackKey: |
561 | | -isSemanticCurrentRequest && opts?.runSessionKey |
| 569 | +(isSemanticCurrentRequest || isImplicitRunSessionStatus) && opts?.runSessionKey |
562 | 570 | ? opts.runSessionKey |
563 | 571 | : storeScopedRequesterKey, |
564 | 572 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。