Robust retry#4
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50d74fc361
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| const envPath = path.join(root, ".env"); | ||
| if (fs.existsSync(envPath)) { | ||
| loadDotenv({ path: envPath }); |
There was a problem hiding this comment.
Isolate per-project env instead of reusing global values
Load logic currently writes each project's .env directly into process.env without override, so a second project in the same Pi process can inherit credentials from the first project (for example OPENROUTER_API_KEY), because existing keys are kept and then forwarded by getSubagentEnv. This can route subagent traffic to the wrong account whenever users switch repositories in one session.
Useful? React with 👍 / 👎.
| if (fs.existsSync(envPath)) { | ||
| loadDotenv({ path: envPath }); | ||
| } | ||
| loadedRoots.add(root); |
There was a problem hiding this comment.
Re-read
.env after first load attempt
The root is marked as loaded even when .env is absent, so if a user creates or updates .env later in the same session (for example after an auth failure), subsequent subagent launches never pick up the new values because loadProjectEnv exits early. This makes recovery require a full restart instead of working on retry.
Useful? React with 👍 / 👎.
|
@hlibr I got rid of redundant env changes, as well as addressed all the codex comments. |
Adds robust retry handling for agent RPC calls when OpenRouter/provider limits or transient errors occur.
agentRetryworkflow settings.Retry-Afterstyle hints when present.