Skip to content

fix(client-runtime): recover queries after reconnects - #8

Merged
Zain-Repo merged 4 commits into
mainfrom
codex/pr-8117-query-recovery
Sep 1, 2026
Merged

Zain-Repo merged 4 commits into
mainfrom
codex/pr-8117-query-recovery

Conversation

@Zain-Repo

Copy link
Copy Markdown
Owner

Summary

Recover environment queries after a provider session is replaced during reconnects while preserving genuine query failures.

Validation

  • Focused runtime tests: 21 passed
  • Client-runtime typecheck passed

Upstream reference: pingdotgg/t3code#8117

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T18:18:46.588646Z 0f68311 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 1, 2026

@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: e9c36ab1e3

ℹ️ 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".

case "connecting":
case "backoff":
return Effect.never;
case "available":

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 Keep queries waiting during the initial connection

When a query mounts immediately after a supervisor is acquired, the supervisor still starts in available with no session (connection/supervisor.ts:235-242) because connect only queues ConnectRequested (connection/supervisor.ts:756-761). Treating that transient state as a failure makes every normal initial connection publish EnvironmentRpcUnavailableError; the web/mobile query hooks display any Failure even while it is waiting, so users can see a spurious “not connected” error until the first RPC succeeds. Keep this state waiting until the queued connection attempt advances, or update the supervisor state synchronously when connecting.

Useful? React with 👍 / 👎.

@Zain-Repo

Copy link
Copy Markdown
Owner Author

@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: 12495e88d9

ℹ️ 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".

switch (connectionState.phase) {
case "connected":
return Option.isSome(session)
? runInEnvironment(target.environmentId, options.execute(target.input))

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 Avoid preserving disconnect failures as query errors

When the transport drops after this branch observes Some(session) but before options.execute calls currentSession, the request can still fail with EnvironmentRpcUnavailableError; the subsequent session-ref emission recomputes the atom with Effect.never, but makeEffect carries that settled failure forward as a waiting Failure, which the web/mobile query hooks render until reconnection succeeds. Fresh evidence beyond the earlier initial-state report is this non-atomic second session read during an established query, so the unavailable failure must be converted back to a non-failure waiting state when the session disappears rather than being preserved like a genuine RPC failure.

Useful? React with 👍 / 👎.

@Zain-Repo

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 0f68311999

ℹ️ 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".

@Zain-Repo
Zain-Repo merged commit 52531f6 into main Sep 1, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant