Skip to content

fix(desktop): prevent a second server from breaking active threads - #10360

Open
t3dotgg wants to merge 1 commit into
mainfrom
t3code/fix-broken-thread
Open

t3dotgg wants to merge 1 commit into
mainfrom
t3code/fix-broken-thread

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

Opening desktop while the background server is running can start a second server on port 3774 against the same database. The second server marks running threads as lost and cannot resume their Codex sessions because the original server still owns them. Follow-up messages then fail with already has an active writer.

Desktop now refuses startup when its default port is occupied instead of scanning for another port. The error explains how to use the running server or a separate T3 home. Explicit port settings retain their current behavior.

This brings #9003 onto current main after confirming the exact failure in a live thread. Credit to @maxibotstef for the original fix. This covers the automatic desktop fallback path. General server directory locking is separate.

Validation: all 5 focused tests passed, desktop typecheck passed, and targeted lint and format checks passed. No browser or desktop UI was launched.

Created with GPT-6 Astra in Codex.

Closes #6097

Apply the desktop startup fix from PR 9003 on current main.

Co-authored-by: Stef <stefan.auerweck@gmail.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 6, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This changes packaged desktop startup’s default port-conflict behavior: the app now refuses to start rather than selecting a fallback port, to avoid competing with an existing server. The change is narrowly scoped and tested, but the altered default startup behavior warrants human review.

Not approved because:

  • Monthly spending limit reached (workspace setting). Approvability relies on correctness review in order to determine eligibility

Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more.

@t3dotgg

t3dotgg commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

Note

🤖 GPT-6 Astra responding on behalf of Theo

@cursor review

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.6 KiB +53 B (+0.4%) 15.1 KiB ✅
Codex Thread snapshot wire 7.0 KiB 7.0 KiB 0 B (0.0%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.5 KiB 6.6 KiB +53 B (+0.8%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 57.0 KiB 57.1 KiB +88 B (+0.2%) 66.4 KiB ✅
Codex Live turn messages 8 10 +2 (+25.0%) 21 ✅
Claude Total thread wire 13.6 KiB 13.6 KiB +16 B (+0.1%) 15.1 KiB ✅
Claude Thread snapshot wire 7.0 KiB 7.0 KiB +3 B (+0.0%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.5 KiB 6.6 KiB +13 B (+0.2%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 57.8 KiB 57.9 KiB +44 B (+0.1%) 66.4 KiB ✅
Claude Live turn messages 9 10 +1 (+11.1%) 21 ✅

Baseline: 223ff44 · PR result: 4a3bda1 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.5 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@shivamhwp

Copy link
Copy Markdown
Collaborator

Note: GPT-6 on behalf of shivam (@shivamhwp).

Please correct the startup error's recovery guidance. It suggests using a different T3CODE_HOME, but port selection still refuses startup whenever 3773 is occupied and no explicit port is configured, regardless of the data directory. Changing only T3 home therefore repeats the same error. For a separate environment, the guidance needs both a separate home and an explicit free T3CODE_PORT; changing only the port must not be presented as safe for an already-owned home.

@tomasmach

Copy link
Copy Markdown

Me on behalf of me:

Please merge this, been hitting this error pretty often, thanks!

This branch has not been deployed

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

Labels

size:M 30-99 changed lines (additions + deletions). 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.

[Bug]: Desktop starts a second backend against the background service database

3 participants