fix(runtime): isolate channel messages by target

This commit is contained in:
2026-08-05 19:03:34 +08:00
parent 7cac422a31
commit a68b7cf3bf
3 changed files with 33 additions and 2 deletions
@@ -754,6 +754,16 @@ export class LineUpRuntime {
runtimeLog("message.ignored", { stage: "sender" });
return;
}
// The AppServer channel is shared by several users. Agent envelopes carry
// the intended human target; discard another user's message before scope
// validation so it is not reported as a malformed message for this user.
const parsedEnvelope = parseEnvelopeJSON(payload);
if (parsedEnvelope.ok
&& parsedEnvelope.envelope.target?.kind === "human"
&& parsedEnvelope.envelope.target.id !== this.session.uid) {
runtimeLog("message.ignored", { stage: "target" });
return;
}
if (message.from_uid === this.session.uid) {
const own = parseEnvelopeJSON(payload);
if (own.ok && CONTROL_ECHO_TYPES.has(own.envelope.type)) return;