mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-19 06:15:06 +00:00
fix(agent): propagate SenderID in AgentEvent emitters
Expose the original acting sender ID in agent events so group-chat telemetry and audit logs stay aligned with the real Telegram user instead of only the group-scoped UserID.
This commit is contained in:
1 parent
680521a882
commit
a29938ceed
5 files changed
+10
-1
No files matched your search
@@ -71,6 +71,7 @@ func TestMakeExecuteToolCall_EmitsToolCallEvent(t *testing.T) {
|
||||
RunID: "run-1",
|
||||
SessionKey: "sess-A",
|
||||
UserID: "u-1",
|
||||
SenderID: "sender-1",
|
||||
Channel: "ws",
|
||||
RunKind: "",
|
||||
}
|
||||
@@ -102,6 +103,7 @@ func TestMakeExecuteToolRaw_EmitsToolCallEvent(t *testing.T) {
|
||||
RunID: "run-2",
|
||||
SessionKey: "sess-B",
|
||||
UserID: "u-2",
|
||||
SenderID: "sender-2",
|
||||
Channel: "ws",
|
||||
RunKind: "",
|
||||
}
|
||||
@@ -133,7 +135,7 @@ func TestMakeExecuteToolRaw_ConcurrentCallsEmitAllEvents(t *testing.T) {
|
||||
col := &eventCollector{}
|
||||
l := newTestLoopForToolCallbacks(col.onEvent)
|
||||
|
||||
req := &RunRequest{RunID: "run-3", SessionKey: "sess-C", UserID: "u-3", Channel: "ws"}
|
||||
req := &RunRequest{RunID: "run-3", SessionKey: "sess-C", UserID: "u-3", SenderID: "sender-3", Channel: "ws"}
|
||||
exec := l.makeExecuteToolRaw(req)
|
||||
|
||||
const n = 5
|
||||
@@ -175,6 +177,9 @@ func assertToolCallPayload(t *testing.T, ev AgentEvent, tc providers.ToolCall, r
|
||||
if ev.UserID != req.UserID {
|
||||
t.Errorf("UserID: got %q, want %q", ev.UserID, req.UserID)
|
||||
}
|
||||
if ev.SenderID != req.SenderID {
|
||||
t.Errorf("SenderID: got %q, want %q", ev.SenderID, req.SenderID)
|
||||
}
|
||||
payload, ok := ev.Payload.(map[string]any)
|
||||
if !ok {
|
||||
t.Fatalf("Payload is not map[string]any: %T", ev.Payload)
|
||||
|
||||
Reference in new issue
Block a user