@@ -973,18 +973,14 @@ export async function runEmbeddedPiAgent(
973973 }
974974 startupStages . mark ( "auth" ) ;
975975 notifyExecutionPhase ( "auth" , { provider, model : modelId } ) ;
976- const codexHarnessOwnsTransport = pluginHarnessOwnsTransport && agentHarness . id === "codex" ;
977- // Codex builds OpenClaw tools inside its harness. Keep the full store on
978- // the existing field so installed Codex packages can resolve tool auth.
979- const runAttemptAuthProfileStore =
980- pluginHarnessOwnsTransport && ! codexHarnessOwnsTransport
981- ? createScopedAuthProfileStore (
982- attemptAuthProfileStore ,
983- pluginHarnessForwardedProfileCandidates . length > 0
984- ? pluginHarnessForwardedProfileCandidates
985- : lastProfileId ,
986- )
987- : attemptAuthProfileStore ;
976+ const runAttemptAuthProfileStore = pluginHarnessOwnsTransport
977+ ? createScopedAuthProfileStore (
978+ attemptAuthProfileStore ,
979+ pluginHarnessForwardedProfileCandidates . length > 0
980+ ? pluginHarnessForwardedProfileCandidates
981+ : lastProfileId ,
982+ )
983+ : attemptAuthProfileStore ;
988984 const { sessionAgentId } = resolveSessionAgentIds ( {
989985 sessionKey : params . sessionKey ,
990986 config : params . config ,
@@ -1448,6 +1444,8 @@ export async function runEmbeddedPiAgent(
14481444 initialReplayState : accumulatedReplayState ,
14491445 authStorage,
14501446 authProfileStore : runAttemptAuthProfileStore ,
1447+ // Codex builds OpenClaw tools inside its harness. Keep transport
1448+ // auth scoped while letting tool construction see plugin creds.
14511449 toolAuthProfileStore : agentHarness . id === "codex" ? attemptAuthProfileStore : undefined ,
14521450 modelRegistry,
14531451 agentId : workspaceResolution . agentId ,
0 commit comments