Skip to content

Commit de88532

Browse files
authored
Merge pull request #465 from docker/copilot/fix-oauth-log-session-issues
Fix spurious OAuth warning by setting rootSessionID for local runtime
2 parents b64ba8d + 3f50a70 commit de88532

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cmd/root/run.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,17 +292,20 @@ func doRunCommand(ctx context.Context, args []string, exec bool) error {
292292
rt = remoteRt
293293
slog.Debug("Using remote runtime", "address", remoteAddress, "agent", agentName)
294294
} else {
295-
// Create local runtime
295+
// Create session first to get its ID for OAuth state encoding
296+
sess = session.New(session.WithMaxIterations(agents.Agent(agentName).MaxIterations()))
297+
sess.ToolsApproved = autoApprove
298+
299+
// Create local runtime with root session ID for OAuth state encoding
296300
localRt, err := runtime.New(agents,
297301
runtime.WithCurrentAgent(agentName),
298302
runtime.WithTracer(tracer),
303+
runtime.WithRootSessionID(sess.ID),
299304
)
300305
if err != nil {
301306
return fmt.Errorf("failed to create runtime: %w", err)
302307
}
303308
rt = localRt
304-
sess = session.New(session.WithMaxIterations(rt.CurrentAgent().MaxIterations()))
305-
sess.ToolsApproved = autoApprove
306309
slog.Debug("Using local runtime", "agent", agentName)
307310
}
308311

0 commit comments

Comments
 (0)