Skip to content

fix(desktop): register daemon sessions with port manager on startup - #964

Merged
Kitenite merged 1 commit into
mainfrom
kiet-ho/guppy
Jan 26, 2026
Merged

Kitenite merged 1 commit into
mainfrom
kiet-ho/guppy

Conversation

@Kitenite

@Kitenite Kitenite commented Jan 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Fix port scanning not working for terminals already running after app restart/update
  • Register preserved daemon sessions with port manager during reconcileOnStartup()
  • Enables immediate port detection without requiring user to open each terminal tab

Test plan

  • Start a dev server in a terminal (e.g., bun dev)
  • Verify port appears in the ports panel
  • Restart the desktop app (Cmd+R or quit and reopen)
  • Verify port still appears in the ports panel without opening the terminal tab

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved reliability of session restoration when the application restarts, ensuring all previously active connections are properly re-initialized and available.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 26, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Kitenite has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 5 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

The change adds session registration logic during startup reconciliation, iterating through preserved sessions and invoking portManager.upsertDaemonSession() for each to populate port-manager state. This ensures port scanning recognizes previously active sessions following a restart.

Changes

Cohort / File(s) Summary
Port Manager Registration During Startup
apps/desktop/src/main/lib/terminal/daemon/daemon-manager.ts
Added loop in reconcileOnStartup() to register each preserved session with port manager via portManager.upsertDaemonSession(paneId, workspaceId, pid), enabling port scanning to recognize sessions that survived restart.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • superset-sh/superset#852: Also modifies reconcileOnStartup() in daemon-manager to handle session hydration and port-manager registration behavior.

Poem

🐰 After a restart, sessions rise again,
Port manager now remembers each den,
Loops through preserved with care and grace,
Sessions alive in their rightful place! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: registering daemon sessions with port manager on startup, which directly addresses the bug fix.
Description check ✅ Passed The description provides a clear summary, test plan, and context. However, it does not follow the required template structure with all sections like Related Issues, Type of Change, and Screenshots.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Port scanning was not working for terminals that were already running
after an app restart or update. The issue was that reconcileOnStartup()
cached session IDs but did not register them with the port manager.
Port scanning only started working after the user manually opened each
terminal tab, which triggered createOrAttach() to call upsertDaemonSession().

Now preserved daemon sessions are registered with the port manager
during startup reconciliation, enabling immediate port detection.
@Kitenite
Kitenite merged commit ab2e599 into main Jan 26, 2026
5 checks passed
@Kitenite
Kitenite deleted the kiet-ho/guppy branch January 26, 2026 17:33
@github-actions

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

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