Skip to content

feat(sessions): transfer a session to another owner (v0.193.0)#321

Merged
vikasprogrammer merged 1 commit into
mainfrom
feat/transfer-session-owner
Jul 14, 2026
Merged

feat(sessions): transfer a session to another owner (v0.193.0)#321
vikasprogrammer merged 1 commit into
mainfrom
feat/transfer-session-owner

Conversation

@vikasprogrammer

Copy link
Copy Markdown
Owner

What

Adds the ability to transfer a session to another owner from the Sessions list.

A session's accountable human is its run_as — the identity it acts as, and the key its ownership, the "mine" filter, the owner chip, and connectors/identity of any future effect all derive from. This lets an owner/admin (or the session's current owner) hand a run off to a teammate.

How

  • src/terminal.tsTerminalManager.transferSession(sessionId, by, toMemberId): validates the target is a real member, updates run_as, and audits session.transferred ({from, to, agent}). Provenance (spawned_by — what originally triggered the run) is deliberately left untouched. No DB migration — run_as already exists.
  • src/server.tsPOST /api/sessions/:id/transfer: the existing canViewSession gate plus an accountability gate (owner/admin, or the session's current run_as), mirroring the UI.
  • webapi.transferSession wrapper + a reusable <TransferMenu> (base-ui DropdownMenu member picker), wired into both the grid (labeled button) and list (icon) Sessions views. Optimistic owner-chip update, reconciled by the poll.

Verify

  • npm run typecheck ✓ · cd web && npm run build
  • In-process harness on an isolated scratch home: transfer reassigns run_as, no-op re-transfer succeeds, unknown-member → unknown member, unknown-session → unknown session, and the session.transferred audit row lands with {from,to,agent} under the actor's principal.

🤖 Generated with Claude Code

Reassign a session's run_as (the accountable human it acts as) from the
Sessions list. A new Transfer control in each session's action row picks a
target member; ownership, the "mine" filter, the owner chip, and future
connector/identity resolution all follow the new run_as, while provenance
(spawned_by) is left untouched.

- src/terminal.ts: TerminalManager.transferSession(sessionId, by, toMemberId)
  — validates target member, updates run_as, audits session.transferred
  ({from,to,agent}). No schema change (run_as already existed).
- src/server.ts: POST /api/sessions/:id/transfer — canViewSession gate plus
  owner/admin-or-current-owner accountability gate.
- web: api.transferSession wrapper + a reusable <TransferMenu> (base-ui
  DropdownMenu member picker) wired into both the grid and list Sessions views.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vikasprogrammer vikasprogrammer merged commit d288083 into main Jul 14, 2026
1 check passed
@vikasprogrammer vikasprogrammer deleted the feat/transfer-session-owner branch July 14, 2026 10:48
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