This repository was archived by the owner on Aug 17, 2026. It is now read-only.
Repository navigation
Commit c770aec
committed
feat(grunt/tui): persist peer-id on session row —
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.gruntcode -s <id> alone recovers identity (#13)1 parent d4f302c commit c770aec
5 files changed
Lines changed: 1705 additions & 2 deletions
File tree
- packages/opencode
- migration/20260527000333_add_session_peer_id
- src
- cli/cmd/tui
- session
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments