Skip to content

feat(pi-session-deck): add session identity layer with Git/PR resolution#93

Open
robhowley wants to merge 8 commits into
mainfrom
pi-session-deck-p2-identity
Open

feat(pi-session-deck): add session identity layer with Git/PR resolution#93
robhowley wants to merge 8 commits into
mainfrom
pi-session-deck-p2-identity

Conversation

@robhowley

@robhowley robhowley commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Session Identity Layer (P2)

Adds a persistent session identity layer to pi-session-deck, stored separately from heartbeat presence data. Enables the deck to show Git context, PR URLs, and session metadata for each runtime.

New modules

Module Purpose
identity/types.ts SessionIdentityRecord type (14 fields)
identity/store.ts Path resolution to ~/.pi/session-deck/identity/
identity/writer.ts Atomic write (mkdirp + write + rename)
identity/git.ts Git info resolver + PR URL via gh CLI or remote fallback
identity/collector.ts Gathers sessionManager + Git + process fields
identity/runtime.ts Lifecycle manager with 45s periodic refresh
identity/reader.ts readJoinedSessionView() merges presence + identity by runtimeId
identity/command.ts --identity flag, registerSessionDeckCommand, joined render

Changes

  • index.ts — start identity runtime on session_start, refresh on /new
  • package.json — v0.3.0 with identity description
  • CHANGELOG.md, README.md — identity layer docs
  • __tests__/session-deck/identity-*.test.ts — 3 new test files (16 tests)

Acceptance criteria

  • Live runtime appears even before identity collection completes
  • /new updates sessionId/sessionFile but keeps runtimeId
  • Git failures don't hide the runtime row
  • Missing identity doesn't hide the runtime row

- add SessionIdentityRecord type and identity store (~/.pi/session-deck/identity/) - add atomic identity writer (mkdirp + write + rename) - add Git info resolver (worktree, branch, remote, root) and PR URL resolver (gh CLI + remote fallback) - add identity collector gathering sessionManager + Git + process fields - add identity runtime with 45s periodic refresh, lifecycle caching - add joined session reader merging presence + identity by runtimeId - add /session-deck --identity flag and identity column in output - update index.ts to start identity runtime on session_start, refresh on /new - add 3 new test files (git, writer, reader) covering 16 identity tests - bump to v0.3.0
…avoid real config file in tests

- add optional configPath parameter to loadConfig() - update config-logger test to pass non-existent path, isolating from real ~/.pi/agent/yolo-seatbelt.json
… EOF corrections

- fix missing newline at end of 4 test files - reformat long import lines - add optional configPath param to loadConfig
…ain edits

- Restore CHANGELOG.md and package.json to main (no manual edits) - Restore README.md to main, then cleanly add description, commands, and 'What it provides' section without architecture file tree
…dic identity refreshes

The 45s periodic refresh in runtime.ts was calling refreshIdentity('periodic') without a\nsessionManager reference, causing collector.ts to fall back to sessionId=null and\nsessionFile=null on every periodic refresh. Now sessionManager is captured once on\nthe initial startup call and reused across all subsequent periodic refreshes.
…StartedAt, diagnostics, PR fallback, tests

Issue 1: Store sessionManager in runtime state so periodic refreshes don't lose session context.
Issue 2: Preserve sessionStartedAt across refreshes via existingRecord passer.
Issue 3: Emit granular diagnostics from collector (session_id_missing, not_git_repo, detached_head, pr_ambiguous, etc.).
Issue 4: PR fallback now returns null+pr_ambiguous instead of constructing fake .../pull/<branch> URLs.
Issue 5: Add identity-collector.test.ts (6 tests) and identity-runtime.test.ts (10 tests) covering periodic refresh, /new, sessionStartedAt preservation, and singleton behavior.
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