feat: scope API MCP OAuth by principal

This commit is contained in:
wizardchen
2026-06-30 09:21:49 +08:00
committed by lyingbug
parent 77e4f93e3e
commit cb99736d72
39 changed files with 1566 additions and 108 deletions
+2 -2
View File
@@ -392,13 +392,13 @@ func (e *AgentEngine) runToolCall(
},
})
userID, _ := types.UserIDFromContext(ctx)
principal, _ := types.PrincipalFromContext(ctx)
toolExecCtx := agenttools.WithToolExecContext(toolCtx, &agenttools.ToolExecContext{
SessionID: sessionID,
AssistantMessageID: assistantMessageID,
EventBus: e.eventBus,
ToolCallID: tc.ID,
UserID: userID,
UserID: principal.StorageID(),
// ApprovalCtx keeps the round-level ctx without the per-tool 60s timeout,
// so MCP tool human-approval (issue #1173) can legitimately block longer.
ApprovalCtx: toolCtx,