Skip to content

fix(discord-bot): survive guest T3 restarts without stuck project lookups - #137

Merged
patroza merged 1 commit into
fork/discordfrom
t3code/fix-server-restart-connection
Jul 28, 2026
Merged

fix(discord-bot): survive guest T3 restarts without stuck project lookups#137
patroza merged 1 commit into
fork/discordfrom
t3code/fix-server-restart-connection

Conversation

@patroza

@patroza patroza commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

After a guest/server restart, Discord can come READY before T3 is listening. The bot either exited on first connect failure or connected without a shell snapshot, so later mentions looked like “no T3 project registered at path” and stayed stuck until a manual bot restart.

  • Boot: connectUntilReady retries forever with the same backoff as mid-life reconnect (process stays up).
  • Connect success requires the orchestration shell snapshot (15s wait); partial sessions are fully torn down so the next attempt can rebuild.
  • Transport errors on dispatch force reconnect when RpcSession.closed is slow/missed (no auto-retry of the command — avoids double-start).
  • UX: distinguish “still connecting” from a real missing project / alias mismatch.

Test plan

  • vp test run src/t3/T3Session.test.ts (transport error helpers + existing model tests)
  • vp check on changed files
  • On a guest: restart T3 while bot is up; confirm bot logs reconnect + shell ready
  • Restart bot before T3; confirm bot does not exit and eventually connects
  • During reconnect window, @mention gets “still connecting… try again” (not false “no project registered”)
  • After ready, new reply starts a normal turn / continues existing thread

…kups

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.
@patroza
patroza merged commit 1a17d98 into fork/discord Jul 28, 2026
1 check passed
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza added a commit that referenced this pull request Jul 28, 2026
…kups (#137)

Boot used a single connect attempt and could mark the session ready before the
shell snapshot arrived, so mentions after a restart looked like missing projects
and stayed broken until a manual bot restart. Retry connect until shell-ready,
tear down partial sessions, force reconnect on transport errors, and surface a
transient "still connecting" message instead of a false alias/path failure.

Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
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.

1 participant