Skip to content

feat (ui): reconnect desktop ACP sessions after sleep and connection loss - #10411

Merged
lifeizhou-ap merged 3 commits into
mainfrom
lifei/acp-reconnect
Jul 13, 2026
Merged

feat (ui): reconnect desktop ACP sessions after sleep and connection loss#10411
lifeizhou-ap merged 3 commits into
mainfrom
lifei/acp-reconnect

Conversation

@lifeizhou-ap

@lifeizhou-ap lifeizhou-ap commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Added desktop ACP recovery after laptop sleep or connection loss.

  • Reconnect with capped backoff and jitter.
  • Reconnect immediately after system resume.
  • Restore active chat sessions.
  • Block submissions while reconnecting.
  • Stop retrying after permanent backend exit.

Testing

Unit testing and manual

Related issue

Fix #10368

@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: 9ecd99c9c9

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

Comment on lines +189 to +193
} catch (error) {
if (generation !== connectionGeneration) {
throw error;
}
}

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-throw permanent reconnect failures

When the goose serve backend has exited, the get-acp-url IPC path calls GooseServeLeaseRegistry.getAcpUrl, which throws GOOSE_SERVE_EXITED_USER_MESSAGE instead of returning a URL. This catch treats that permanent error like a transient socket failure and retries forever, so after an unexpected backend exit the renderer stays in recovering and every getAcpClient() caller waits on a never-settling pendingConnection instead of surfacing the close-window error.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

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

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

Comment on lines +154 to +155
if (isAcpRecovering()) {
return;

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 Do not drop auto-submitted prompts during recovery

When a session with an initialMessage/shouldStartAgent is mounted while ACP recovery is in progress, useAutoSubmit marks the prompt as submitted and clears the initial message immediately after calling handleSubmit; this new guard then silently returns before queuing or sending anything. After reconnect, the auto-submit effect will not retry because hasAutoSubmittedRef is already true, so deep-link/fork/continue flows can lose the user's prompt instead of sending it once the connection is restored.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@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: 4924819ec6

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

Comment on lines +154 to +155
if (isAcpRecovering()) {
return;

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 Preserve append submissions during reconnect

Fresh evidence beyond the earlier auto-submit case is that BaseChat still wires recipe activities and message-list append actions directly to handleSubmit, and those controls are not disabled by queueProcessingBlocked. When a user clicks one of those append controls while ACP recovery is active, this guard returns without adding a local message or retrying after recovery, so the prompt is silently lost; please either disable those append entry points while reconnecting or keep the submitted input pending instead of dropping it here.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is a valid edge case. Normal submissions are blocked and auto-submit is delayed during recovery. Recipe/MCP append actions are rare during the brief reconnect window, so we’re leaving them out of scope to avoid additional queueing complexity.

@lifeizhou-ap lifeizhou-ap changed the title acp reconnect feat: reconnect desktop ACP sessions after sleep and connection loss Jul 13, 2026
@lifeizhou-ap lifeizhou-ap changed the title feat: reconnect desktop ACP sessions after sleep and connection loss feat (ui): reconnect desktop ACP sessions after sleep and connection loss Jul 13, 2026
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.

Failed to Load Session Submit error: ACP connection closed

3 participants