Skip to content

Robust retry#4

Open
cryptosebek wants to merge 10 commits into
hlibr:masterfrom
cryptosebek:robust-retry
Open

Robust retry#4
cryptosebek wants to merge 10 commits into
hlibr:masterfrom
cryptosebek:robust-retry

Conversation

@cryptosebek

Copy link
Copy Markdown

Adds robust retry handling for agent RPC calls when OpenRouter/provider limits or transient errors occur.

  • Added configurable agentRetry workflow settings.
  • Retries retryable provider/transport failures with exponential backoff and jitter.
  • Honors Retry-After style hints when present.
  • Applies retry behavior to PM, developer, and verifier RPC agents.
  • Added tests for retry classification, delay calculation, config defaults, and validation.
  • Fixed existing lint issue in subagent env typing.

@hlibr

hlibr commented May 23, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@cryptosebek

Copy link
Copy Markdown
Author

@hlibr I got rid of redundant env changes, as well as addressed all the codex comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants