Skip to content

T-QMGC-session-list-session-attach-across-hosts-sessions-config

State: closed/done · Impact: medium · Complexity: medium

session list/session attach read session records across hosts; a sessions: config sets defaults per workflow.

There is one session-record location, not one per host: every launch — headless or interactive, whichever host it opened on — writes a SessionRecord to .sdlc/sessions/<id>/record.json under the project root (solutions/ontological/lib/services/session/record.ts). SessionRecord gained a hostSessionId: string | null field (the host’s own id, threaded through from T-QO8E’s HostParts.session contract) and logPath became string | null (an interactive launch captures no output, per hosts/terminal.ts’s @sdlc:ignore-spawn exception). sdlc session launch’s interactive path (solutions/ontological/lib/services/session/ops/launch.ts) previously wrote no record at all; it now writes exactly one, right after launchInteractive returns (that call is synchronous, so the session has already ended and its exit code is already known — no separate in-flight write like the headless path’s).

  1. sdlc session list (lib/services/session/ops/list.ts, new): lists .sdlc/sessions/, reads each record.json via readSessionRecord, skips one that fails to parse, and renders a table (renderTable from lib/util/table.ts, the same helper lease list re-exports) sorted most-recently-started first. --host <name> filters to one host. Empty case prints (no sessions).

  2. sdlc session attach <id> (lib/services/session/ops/attach.ts, new): looks up the record by id and dispatches on record.host:

    record.hostCommand when hostSessionId capturedFallback
    null (headless)— (nothing interactive to attach to)Prints where the captured log landed, or that none was captured.
    terminal / orca / cmux— (no attach mechanism today)Prints a how-to pointing at the host’s own tooling. Building one is out of scope.
    claudeclaude attach <hostSessionId>How-to pointing at claude attach’s own interactive picker.
    codexcodex resume <hostSessionId>Best-effort codex resume --last (may resume the wrong session if another has launched since).
    cursorcursor-agent --resume <hostSessionId> (only when cursor-agent is also on PATH)How-to.

    The actual resume/attach spawn is a raw, blocking, stdio: "inherit" child (same documented exception as hosts/terminal.ts), reached through an injectable spawnSyncFn seam so tests never launch a real claude/codex/cursor-agent.

  3. sessions: config (lib/config/load.ts, next to host:): sessions.workflows.<name>. {engine,host} — a per-workflow-name default consulted ONLY by session launch --workflow <name> (not --skill/--prompt, which have no workflow name to key off), below --engine/--host but above the hardcoded 'claude'/host.default fallbacks. Distinct from the existing orchestrator.workflows.<name>.{engine,host}, which stays scoped to the orchestrator’s own tick dispatch — same shape, deliberately not shared.

AreaNote
solutions/ontological/lib/services/session/ops/list.tsnew: session list
solutions/ontological/lib/services/session/ops/attach.tsnew: session attach
solutions/ontological/lib/services/session/ops/launch.tsinteractive path now writes a SessionRecord; sessions.workflows resolution
solutions/ontological/lib/services/session/record.tsSessionRecord.hostSessionId added, logPath is now nullable
solutions/ontological/lib/services/host/index.tsre-exports onPath for session attach’s cursor-agent PATH guard
solutions/ontological/lib/config/load.tssessions: config block
  • AC-1: sdlc session list shows sessions launched on at least two different hosts in one listing. Verified in lib/services/session/list.test.ts (“shows sessions launched on two different hosts in one listing”).
  • AC-2: A sessions: default for a workflow is applied when no host is explicitly given. Verified in lib/services/session/launch.test.ts (“session launch: sessions.workflows config default”).
  • Building an attach mechanism for the terminal/orca/cmux wrapper hosts — session attach reports how to reopen the work through each host’s own tooling instead.
  • session list reading anything other than .sdlc/sessions/ under the project root — there is one record location for every host, not one per host.
  • T-QO8E — session attach’s claude/codex/cursor branches consume the hostSessionId those hosts’ HostParts.session implementations return.

← Back to Tasks