fix(tasks): honor explicit agentId in gateway tasks.list and repair t… · openclaw/openclaw@77d6ad6
Alix-007
·
2026-06-15
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -114,15 +114,18 @@ function taskMatchesSession(task: TaskRecord, sessionKey: string | undefined): b
|
114 | 114 | ); |
115 | 115 | } |
116 | 116 | |
117 | | -// Some records predate a direct `agentId`, so task listings still recover the |
118 | | -// owning agent from session-style keys instead of hiding those tasks. |
| 117 | +// Explicit `task.agentId` is authoritative: a task that records its own agent |
| 118 | +// must not also match other agents through the session-key fallback. Only |
| 119 | +// records that predate a direct `agentId` recover the owning agent from |
| 120 | +// session-style keys instead of being hidden. |
119 | 121 | function taskMatchesAgent(task: TaskRecord, agentId: string | undefined): boolean { |
120 | 122 | const normalized = normalizeOptionalString(agentId); |
121 | 123 | if (!normalized) { |
122 | 124 | return true; |
123 | 125 | } |
124 | | -if (normalizeOptionalString(task.agentId) === normalized) { |
125 | | -return true; |
| 126 | +const explicitAgentId = normalizeOptionalString(task.agentId); |
| 127 | +if (explicitAgentId) { |
| 128 | +return explicitAgentId === normalized; |
126 | 129 | } |
127 | 130 | return [task.requesterSessionKey, task.childSessionKey, task.ownerKey].some( |
128 | 131 | (candidate) => parseAgentSessionKey(candidate)?.agentId === normalized, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。