fix: prefer sessionKey over label in sessions_send#39551
Conversation
Greptile SummaryThis PR fixes a regression where Changes:
One thing to be aware of: When All downstream permission checks ( Confidence Score: 4/5
Last reviewed commit: 852bbe2 |
|
Adding a small clarification on the intended precedence rule: the The motivation is compatibility with real LLM-generated tool calls, which often echo multiple target-identifying fields from the same schema ( This does not broaden access or bypass existing checks:
So the behavior change is intentionally narrow: when |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded. The mixed-selector bug is still real on current main, but the active replacement PR #74009 covers the same runtime, test, tool-description, and changelog surfaces, while this branch still has concrete security and test-isolation blockers. So I’m closing this here and keeping the remaining discussion on the canonical linked item. Review detailsBest possible solution: Finish the fix in one canonical branch, preferably #74009 or its successor: remove the mixed Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main gives a high-confidence reproduction path: call Is this the best way to solve the issue? No as this branch stands. Preferring Security review: Security review needs attention: Security review needs attention because the diff can turn currently rejected mixed-selector calls into a session-id resolution path that echoes a resolved key after access denial.
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 53593f0683fa. |
|
ProjectClownfish pushed a narrow repair to this branch so the original contributor path can stay canonical. Source PR: #39551 |
852bbe2 to
4a08e3c
Compare
Summary
sessions_sendrejected calls whensessionKeyandlabelwere both present, even ifsessionKeyalready identified the target unambiguously.sessionKey,label, andagentId) from the same schema, which caused avoidable runtime failures.sessions_sendnow treatssessionKeyas authoritative and ignoreslabel/agentIdwhensessionKeyis present. Added a regression test for the mixed-parameter case.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
sessions_sendno longer fails withProvide either sessionKey or label (not both).whensessionKeyis present alongsidelabel/agentId.sessionKeyis provided, it is now used as the source of truth for target selection.Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
sessions_sendwithsessionKey,label, andagentIdtogether.Provide either sessionKey or label (not both).Expected
sessionKeyis present,sessions_sendshould use it directly.label/agentIdshould not cause the call to fail.label-only resolution should still work as before.Either sessionKey or label is required.Actual
sessionKey.Evidence
Human Verification (required)
What you personally verified (not just CI), and how:
corepack pnpm exec vitest run src/agents/tools/sessions.test.tscorepack pnpm exec vitest run src/agents/openclaw-tools.sessions.test.tsprefers sessionKey when sessionKey, label, and agentId are all providedlabel-only behavior remains coveredEither sessionKey or label is requiredCompatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
src/agents/tools/sessions-send-tool.tssrc/agents/tools/sessions.test.tssessionKeyis presentRisks and Mitigations
sessionKeyandlabel, and the tool will now prefersessionKey.