Skip to content

feat(rc-gateway): the sessions-at-rest family gets a gateway path - #74

Merged
InfiniteInsight merged 1 commit into
mainfrom
gateway/111-sessions-at-rest
Oct 24, 2026
Merged

InfiniteInsight merged 1 commit into
mainfrom
gateway/111-sessions-at-rest

Conversation

@InfiniteInsight

Copy link
Copy Markdown
Owner

What

Closes InfiniteInsight/Qwen-Code-Remote#111

The daemon has served POST /sessions/{archive,unarchive,delete} all along and
DaemonClient has had the three calls, but DaemonPool forwarded none of them
and the gateway exposed no route, so the viewer could not reach any of it. Two
missing layers, not a missing capability.

Why it is shaped this way

  • Archive and delete are separate routes, not one route with a flag.
    Archiving is reversible and deleting is not, so delete carries a
    confirm: true the others do not. The check is server-side rather than
    trusted from the client, so a stray call cannot destroy a transcript and the
    guard holds for clients that never draw a dialog.
  • The refusal happens before anything reaches the daemon. The zero-call
    assertion in the test pins that down; a guard that runs after the destructive
    call is not a guard.
  • The daemon's per-id outcome passes through untouched (removed /
    notFound / errors) and a daemon refusal answers 502, never a 200 with an
    empty body. Flattening a partial failure into a bare success is the bug class
    this family is about.
  • workspaceCwd is a pool-routing argument only and is never forwarded.
    The client's second parameter is a daemon clientId, so passing the cwd
    there would be read as an identity rather than a target. Signatures mirror
    DaemonClient's shipped two parameters with cwd appended, which is what
    keeps a plain DaemonClient structurally satisfying SessionDaemon. The
    three-parameter clientIdOrOptions overload exists in SDK source but has not
    reached dist/, so coding against it does not compile.
  • OWNER-scoped like /rc/sessions, since these reach every transcript in a
    workspace rather than one session. Audit records the ids as target, never
    the cwd.

Files

  • packages/rc-gateway/src/routes/sessionRest.ts (new)
  • packages/rc-gateway/src/routes/sessionRest.test.ts (new, 9 tests)
  • packages/rc-gateway/src/daemonPool.ts — three pool forwards + the named
    DaemonDeleteSessionsResult (the SDK declares that shape inline and never
    exports a name for it)
  • packages/rc-gateway/src/auditLog.ts — six action names in the closed union
    and its runtime list
  • packages/rc-gateway/src/server.ts — three mounts

Verification, read off this run

  • rc-gateway suite: 236 files, 2931 passed, 2 skipped, no failures
  • tsc --noEmit clean, eslint src clean
  • 9 new tests, including the two that carry the design: delete refused with
    zero daemon calls, and a truthy-but-not-true confirm treated as no confirm

Not in this PR

The viewer rail row actions. This PR is the gateway half; the rail is the
follow-up that makes it reachable by hand rather than by curl.

The daemon has served POST /sessions/{archive,unarchive,delete} all along and
DaemonClient has had the three calls, but DaemonPool forwarded none of them and
the gateway exposed no route, so the viewer could not reach any of it. Two
missing layers, not a missing capability.

Archive and delete are deliberately separate routes rather than one route with
a flag. Archiving is reversible and deleting is not, so delete carries a
`confirm: true` the others do not, checked server-side rather than trusted from
the client: a stray call cannot destroy a transcript, and the guard holds for
clients that never draw a dialog. The refusal happens before anything reaches
the daemon, which the zero-call assertion in the test pins down -- a guard that
runs after the destructive call is not a guard.

The daemon's per-id outcome (removed / notFound / errors) is passed through
untouched and a daemon refusal answers 502, never a 200 with an empty body:
flattening a partial failure into a bare success is the bug class this family
is about.

workspaceCwd is a pool-routing argument only and is never forwarded. The
client's second parameter is a daemon clientId, so passing the cwd there would
be read as an identity rather than a target. Signatures mirror DaemonClient's
SHIPPED two parameters with cwd appended, which is what keeps a plain
DaemonClient structurally satisfying SessionDaemon; the three-parameter
clientIdOrOptions overload exists in SDK source but has not reached dist, so
coding against it does not compile.

OWNER-scoped like /rc/sessions, since these reach every transcript in a
workspace rather than one session.

Verified: rc-gateway suite 236 files, 2931 passed, 2 skipped, no failures;
tsc --noEmit and eslint src clean; 9 new tests in sessionRest.test.ts.

Closes InfiniteInsight/Qwen-Code-Remote#111
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