Skip to content

Commit 3f50a70

Browse files
Copilotdgageot
andcommitted
Fix spurious OAuth warning by setting rootSessionID for local runtime
Co-authored-by: dgageot <153495+dgageot@users.noreply.github.com>
1 parent ed4baec commit 3f50a70

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)