Skip to content

feat: persist workspace port assignments across restarts (Refs: beans-ocss)#171

Merged
hmans merged 2 commits intomainfrom
beans/minimum-tiglon-5l91
Mar 21, 2026
Merged

feat: persist workspace port assignments across restarts (Refs: beans-ocss)#171
hmans merged 2 commits intomainfrom
beans/minimum-tiglon-5l91

Conversation

@hmans
Copy link
Copy Markdown
Owner

@hmans hmans commented Mar 21, 2026

Summary

  • Workspace port assignments now survive beans serve restarts by persisting the allocated port in each worktree's existing <id>.meta.json metadata file
  • Added AllocateSpecific to portalloc.Allocator for restoring a specific port (with conflict fallback)
  • On startup, saved ports are restored from worktree metadata; new worktrees get a port allocated and immediately persisted
  • Documented the worktree metadata file pattern in CLAUDE.md

Test plan

  • All existing portalloc tests pass
  • New tests for AllocateSpecific: happy path, idempotency, conflict handling, nextIndex advancement
  • All worktree tests pass
  • Manual: create worktrees, restart beans serve, verify ports are preserved

hmans added 2 commits March 21, 2026 10:34
…-ocss)

- Add AllocateSpecific to portalloc for restoring specific ports
- Add Port field to worktreeMeta with SavePort/GetPort on Manager
- Restore persisted ports on startup, fall back to fresh allocation
- Persist port in CreateWorktree resolver
- Document worktree metadata pattern in CLAUDE.md
- Remove redundant nil check on WorktreeMgr in CreateWorktree resolver
- Use allocateNext helper in Allocate to avoid logic duplication
- Always persist actual port on startup (handles conflict fallback)
- Remove extra blank line in worktree.go
@hmans hmans merged commit 42f40a9 into main Mar 21, 2026
1 check passed
@hmans hmans deleted the beans/minimum-tiglon-5l91 branch March 21, 2026 09:54
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