Skip to content
This repository was archived by the owner on Aug 17, 2026. It is now read-only.

Commit c770aec

Browse files
committed
feat(grunt/tui): persist peer-id on session row — gruntcode -s <id> alone recovers identity (#13)
Refs hivemind anomalyco#229 follow-up — Nik's observation: 'I still had to use gruntcode -s ses_... but we are here only thing is I guess I'd have to run the -s and -id right'. Today --peer-id is a flag you have to remember to type every restart. Without it the MCP child registers under `<cwd>#<pid>` which churns every restart and breaks wakeable continuity. ## The fix Persist peer_id on the session row. So: - First launch of a tab: `gruntcode --peer-id nik-coord-main --project ~/foo` (creates session row with peer_id='nik-coord-main') - Every subsequent restart: `gruntcode -s ses_xyz` (reads peer_id from row, sets env before worker spawn → MCP child auto-announces correctly) ## Resolution priority in thread.ts 1. Explicit --peer-id flag (always wins; lets a user re-launch with a NEW identity, also catches up backfilling onto pre-existing session rows) 2. peer_id stored on the session row (when --session <id> is used to resume) 3. unset → MCP child falls back to <cwd>#<pid> Backfill: when both --peer-id AND --session are given, the explicit flag is also UPDATEd onto the row so old sessions get caught up on next resume. ## Schema ALTER TABLE `session` ADD `peer_id` text (drizzle migration generated: migration/20260527000333_add_session_peer_id/migration.sql). Info schema gains optional `peerID` field; fromRow/toRow round-trip it; Session.createNext captures getPeerID() into result.peerID at creation. ## Verified bun typecheck clean. scripts/install-local.sh builds + signs + installs without errors. Bin reports v1.15.10-grunt.7-6-g1e35d2514-dirty-local.
1 parent d4f302c commit c770aec

5 files changed

Lines changed: 1705 additions & 2 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `session` ADD `peer_id` text;

0 commit comments

Comments
 (0)