feat(agent): add configurable MCP OAuth wait timeout per agent

Allow agents to set how long in-conversation OAuth prompts wait before
auto-skipping, with UI in the agent editor and bounded gate behavior.
This commit is contained in:
wizardchen
2026-07-01 14:36:10 +08:00
committed by lyingbug
parent fdfc7297de
commit 4c962a9403
13 changed files with 112 additions and 22 deletions
@@ -283,10 +283,11 @@ func (s *agentService) registerMCPTools(
var regCtx *tools.MCPOAuthSession
if eventBus != nil && sessionID != "" && assistantMessageID != "" {
regCtx = &tools.MCPOAuthSession{
EventBus: eventBus,
SessionID: sessionID,
AssistantMessageID: assistantMessageID,
ApprovalCtx: ctx,
EventBus: eventBus,
SessionID: sessionID,
AssistantMessageID: assistantMessageID,
ApprovalCtx: ctx,
AuthWaitTimeoutSeconds: config.MCPAuthWaitTimeout,
}
}
registered, err := tools.RegisterMCPTools(
@@ -227,6 +227,7 @@ func (s *sessionService) buildAgentConfig(
HistoryTurns: customAgent.Config.HistoryTurns,
MCPSelectionMode: customAgent.Config.MCPSelectionMode,
MCPServices: customAgent.Config.MCPServices,
MCPAuthWaitTimeout: customAgent.Config.MCPAuthWaitTimeout,
Thinking: customAgent.Config.Thinking,
RetrieveKBOnlyWhenMentioned: customAgent.Config.RetrieveKBOnlyWhenMentioned,
LLMCallTimeout: customAgent.Config.LLMCallTimeout,