fix(agents): prefer sessionKey in sessions_send#59324
Conversation
Greptile SummaryThis PR fixes Confidence Score: 5/5
Reviews (1): Last reviewed commit: "fix(agents): prefer sessionKey in sessio..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fbadf07850
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
Fixes sessions_send parameter precedence so callers can pass a stale label alongside an authoritative sessionKey without triggering a rejection, improving robustness of agent-to-agent messaging.
Changes:
- Update
sessions_sendruntime parameter handling to ignorelabelwhensessionKeyis provided. - Add a regression test ensuring mixed
sessionKey + labelinputs bypasssessions.resolveand proceed to send. - Document the precedence rule in the Chinese tools index.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/agents/tools/sessions-send-tool.ts | Adjusts parameter precedence: sessionKey wins and label is ignored. |
| src/agents/tools/sessions.test.ts | Adds regression coverage for mixed sessionKey + label inputs. |
| docs/zh-CN/tools/index.md | Documents that sessionKey/sessionId should take precedence over label. |
….com/Mintalix/openclaw into fix/sessions-send-prefer-session-key
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/agents/tools/sessions-send-tool.ts:118
- This change makes
sessionKeytake precedence by ignoringlabelwhensessionKeyis present, but the tool description string still says “Use sessionKey or label” without stating the precedence/ignore behavior. To match the new behavior (and the PR description), update thesessions_senddescription/docs to explicitly say that ifsessionKeyis provided,label/agentIdare ignored (and label-based resolution only happens whensessionKeyis absent).
parameters: SessionsSendToolSchema,
execute: async (_toolCallId, args) => {
const params = args as Record<string, unknown>;
|
Codex automated review: keeping this open. Current main still has the reported Best possible solution: Keep this PR open as an implementation candidate. The best maintainer path is to land one canonical What I checked:
Remaining risk / open question:
Codex Review notes: model gpt-5.5, reasoning high; reviewed against 5828dcdb05aa. |
Summary
sessions_sendrejected requests that included bothsessionKeyandlabel, even when the caller already had the exact target session.labelwhile still passing the authoritativesessionKey, which caused unnecessary send failures.sessionKeyis present,sessions_sendnow ignoreslabel, sends directly to the resolved session, adds a regression test, and documents the precedence rule.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
sessions_sendtreatedsessionKeyandlabelas mutually exclusive insrc/agents/tools/sessions-send-tool.ts, even thoughsessionKeyis already the authoritative target.sessionKey + labelinput path.git blame, prior PR, issue, or refactor if known): Unknown.Regression Test Plan (if applicable)
src/agents/tools/sessions.test.tssessionKeyandlabelare provided,sessions_sendshould accept the request, usesessionKey, and skipsessions.resolve.User-visible / Behavior Changes
sessions_sendnow preferssessionKeyoverlabelwhen both are present, instead of returning an error.Diagram (if applicable)
Security Impact (required)
If any Yes, explain risk + mitigation: this only changes precedence for an already-authoritative sessionKey; a regression test verifies the tool skips label resolution and uses the provided session directly.
Repro + Verification
Environment
Steps
Expected
The request should use sessionKey and continue successfully.
Actual
Evidence
Human Verification (required)
pnpm test -- src/agents/tools/sessions.test.tsand confirmed the new regression test passes.pnpm build && pnpm check && pnpm test, and a completecodex review --base origin/mainrun.Review Conversations
Compatibility / Migration
If yes, exact upgrade steps: N/A
Risks and Mitigations