Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): Reconnect on a switched-off environment switches it back on #24691

MergedJacksondr5(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/24691/headmerged by maria-rcks View on GitHub

Problem

Disconnect server switches an environment off. If you come back to one of its threads, for example with Back or a reload, the banner says " is offline" and offers Reconnect. Reconnect calls retryNow, which does nothing while the environment is switched off. It stays offline even once the server is back. The only way out is to switch the environment on again in Settings › Connections.

To reproduce:

  1. Pair a second environment and open one of its threads.
  2. Open a thread from another environment, then go back to the first thread.
  3. Stop the second environment's server and wait for "is reconnecting". Press Disconnect server.
  4. Start the server again, then press Back twice.
  5. Press Reconnect. Nothing happens.

Change

In useSystemComposerBanners.tsx, Reconnect now checks the catalog entry the banner already has. If the environment is switched off (entry.enabled === false), Reconnect switches it back on with setEnabled. Otherwise it calls retryNow as before. The label and the failure toast are unchanged.

Scope and approval

This is a very small, focused fix for an obvious bug. The button does nothing, and the fix makes it do what its label says. It changes one file, and no contract or shared code.

Found by @B-EtterDigital in their comment on #22024. It is separate from #22024 itself, which is about the "reconnecting" banner having no retry. #22207 addresses that, but it still sends this switched-off case to retryNow. #22207 also touches nearby lines, so whichever of the two merges second needs a small rebase.

Verification

I ran this in the web app with two local dev servers: A, paired with the browser, and B, saved as a remote environment over a direct connection. I reached the banner by the Back route above, with B already running again before pressing Reconnect. Before and after used the same data, viewport and theme.

  • Before (main): "openclaw is offline" with Reconnect. About 30 seconds after pressing it, the banner still said offline and B's thread was still missing from the sidebar.
  • After: within about 2 seconds of pressing Reconnect, the banner was gone. B's thread was back in the sidebar, and Settings › Connections showed B as Connected. There was no error toast.
mainThis branch
Before pressing Reconnect (same on both)Banner: openclaw is offline, with Reconnect
After pressing ReconnectBanner still offline 30 s after ReconnectBanner gone after Reconnect
Sidebar after pressing ReconnectSidebar without the environment's threadSidebar with the environment's thread back

Settings › Connections after pressing Reconnect on this branch:

Settings row showing the environment Connected

main: Back to the thread, press Reconnect, still offline.

https://github.com/user-attachments/assets/77e0f150-6e7c-4621-b140-8bc78e0daf5c

This branch: Back to the thread, press Reconnect, reconnected.

https://github.com/user-attachments/assets/4c44dc1f-abca-4ed0-9286-2505936d44dd

vp run check:changed passed lint, knip and typecheck, and vp fmt --check passed on the changed file.

I added no test. The fix changes which of two existing commands one button calls. A unit test would mock both commands and assert which one was called, which is the callback-wiring test AGENTS.md asks contributors not to write. setEnabled itself is unchanged and covered by the existing registry tests. The before and after captures show the behaviour.

Not checked: desktop (same web UI).

Known, not changed

On mobile, the connection notice (terminal, review and file preview) shows Retry now on a switched-off environment. It also calls retryNow, so it has the same dead button. It is left for a follow-up because I couldn't test mobile.

Written by Claude Opus 5.5, in Claude Code inside J5 Code, on Jackson's behalf.

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at 2eaaa53

      Macroscope's review found this PR approvable — This is a small, self-contained web bug fix that routes the existing Reconnect action through the established enable-and-connect command only for environments explicitly switched off. Other retry behavior remains unchanged, with no product-default, schema, security, deployment, or static-analysis changes.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between 80455376f01f19c10a06dc08b0629486c017bf79 and 2eaaa533e9233ea3d24c732816eaa873d88a530c.

      Files selected for processing: 1
      • apps/web/src/components/chat/useSystemComposerBanners.tsx

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

      Walkthrough

      The reconnect handler now enables a disabled environment. It continues to retry the connection when the environment is already enabled. Both command results use the existing failure handling.

      Changes: Environment reconnect

      Layer / File(s)Summary
      Reconnect command selection
      apps/web/src/components/chat/useSystemComposerBanners.tsx
      The handler enables a disabled environment and retries an enabled environment. Both results pass through the existing failure handling.
      Priority: Normal

      Estimated code review effort: 2 (Simple) | ~5 minutes

      Change: Bug fix

      Suggested labels: bugfix, size:XS

      Suggested reviewers: juliusmarminge

      Merge Risk: Minimal · up to 2eaaa

      The web reconnect action now handles both disabled and enabled environments as intended.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: Reconnect re-enables a switched-off environment.
      Description checkPassedThe description includes all required sections. It explains the problem and reproduction steps, the implementation, scope rationale, linked issue context, detailed verification results, screenshots an…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Description check

      Explanation

      The description includes all required sections. It explains the problem and reproduction steps, the implementation, scope rationale, linked issue context, detailed verification results, screenshots and recordings, limitations, and agent attribution.

      Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    4. Note

      Written by gpt-6.1-sol on behalf of Maria

      Verified in a real dev environment

      verified as-is at 2eaaa533e9233ea3d24c732816eaa873d88a530c on this linux boat vm, using repo playwright and /usr/bin/google-chrome.

      • installed and ran github/main (32ecd71726) in a separate worktree first, then stopped its dev server before running the exact pr head. ran vp i for both. dev web/server ports were 8693/16733.
      • paired the vm's existing real server as a second environment through a temporary tcp proxy. created a project pointing at the real /home/user/main git worktree through the ui, then ran codex gpt-6.1-sol. no mocks, fixtures or replay provider.
      • stopped the proxy to create a real connection loss, clicked "disconnect server", restored the proxy, and reopened the thread by its saved url. on main, "reconnect" left the offline banner, hidden sidebar thread and settings toggle off despite the server being reachable.
      • with the same saved environment and thread on the pr, "reconnect" removed the banner, restored the sidebar thread, and settings showed connected with its toggle on. a real codex follow-up ran pwd and git rev-parse --is-inside-work-tree, then returned RECONNECT_AFTER_OK in the client.
      • nearby behavior passed: reload preserved the enabled connection and conversation; a later connection loss recovered automatically without using "disconnect server".
      • also created a project for /home/user/t3code through the pr ui and completed a real codex turn through the pr's own server. its visible command output was:
      $ pwd
      /home/user/t3code
      $ git rev-parse HEAD
      2eaaa533e9233ea3d24c732816eaa873d88a530c
      PR_SERVER_OK

      all 29 existing ci checks are successful. no source changes or pushes were needed.

      main after clicking reconnect, still offline:

      main remains offline after reconnect

      pr after clicking reconnect, same conversation and viewport:

      pr reconnect restores the environment and sidebar thread

      real codex follow-up after reconnect:

      codex returns reconnect after ok in the restored thread

      real codex turn through the pr's own server:

      codex reports the exact pr head from the running app

      Not verified

      native desktop, ios/android, macos/windows, relay/tunnel connections, and providers other than codex were not exercised on this linux vm. the already-enabled environment's manual reconnect error path was not reached; automatic recovery was exercised. this pass verified the web/direct-connection flow above.

    5. maria-rcks merged thise5871b6

    6. maria-rcks closed this

Sign in to join this conversation.