Repository navigation
Description
Direction (Jackson, 2026-10-09)
J5's client-facing actions move from J5's own HTTP routes onto WebSocket RPC methods, which is where upstream puts client mutations and where upstream's permission checks, scope middleware and instrumentation apply. Designed together with #137 (typed HTTP for J5 routes, which this may make unnecessary) and #182 (one change stream per environment to replace the J5 read polls).
Where J5 is
| Transport | Count | What is on it |
|---|---|---|
| J5's own HTTP routes | 37 | The older features: Inbox, Fleet, Crews, sidebar reads, archive preflight, artifacts list/read/delete, the playbook library, peering, machine senders |
| WebSocket methods | 32 | The newer features: personas (18), skills (11), playbooks (2), the artifact change stream (1) |
The split is historical. The older features were built as HTTP routes so they would not touch upstream's WebSocket contract. J5 RPC groups now merge into WsRpcGroup through one seam and their handlers live in J5-owned apps/server/src/j5/wsRpc.ts, so more J5 methods cost no new upstream edits.
The gap that prompted this
Found twice in review of the upstream advance (#500). Upstream's convention, now in AGENTS.md under Taste: client mutations use createEnvironmentRpcCommand, protected methods are listed in CLIENT_GUARDED_RPC_SCOPES (packages/contracts/src/clientRpcPermissions.ts), the command's permissionAtom drives whether a control is available, and grants are checked again at execution. In #500, J5's controls are hidden or disabled by the session's scopes, which is interface gating only:
- Already on the helper, not registered. J5's persona actions use
createEnvironmentRpcCommand, but no J5 method is in the guard map, so the helper computes an empty scope requirement and checks nothing. - Not on the helper at all. Crew proposal approve and decline, Crew archive and stop, a seat's runtime-request answer, Inbox answers, and playbook delete and rename call J5's HTTP routes through the unguarded
createEnvironmentCommand(packages/client-runtime/src/j5/state.ts). The guard map is keyed by WebSocket method, so there is nothing to register them with. - Visible effect. A sheet that is already open keeps its submit button if the session's grants are narrowed meanwhile (seen in the mobile persona create and edit sheets). The server refuses, so this is an error message, not an authorization hole.
Work
- Register what is already RPC. One J5 spread into
CLIENT_GUARDED_RPC_SCOPESfor J5's protected methods; switch those controls to the commands'permissionAtom; extend the permission behavior tests as AGENTS.md asks. - Move client-facing mutations to RPC, then register them the same way: Crew proposal preview and resolve, Crew archive and stop, runtime-request answers, Inbox answers, playbook library writes, artifact delete, peering management from the client.
- Reads, with feat(j5): one change stream per environment to replace the J5 read polls #182: replace the polls with the change stream and move the reads it leaves.
- Retire what is left over: the raw HTTP helper in upstream's
environmentHttpAuth.ts(FORK.md case 34) once no J5 caller needs it, and refactor(j5): move Squadron and inbox routes to a typed HttpApiGroup #137 if nothing remains for it.
Stays on HTTP
- Peer-server routes: another server calls them with its own credential.
- Machine-sender routes: scripts and cron jobs call them with a token.
- The MCP endpoint.
To check
- Each route for a reason it must be HTTP (response size, use before the socket is up). The archive preflight and the sidebar reads first.
- Older clients call the HTTP routes: either keep the routes for a release, or require clients and server to update together, as the ledger re-key did (register D29).
Activity
[-]J5's client mutations have no execution-time permission check[/-][+]Move J5's client-facing actions onto WebSocket methods[/+]Jacksondr5 commentedon Oct 10, 2026
For step 3 (reads):
apps/server/src/j5/playbooks/playbookRpc.tsresolves the project or thread workspace in the handler file (inWorkspace, viaresolvePlaybookWorkspaceRoot) before callingPlaybookStore, for export, delete and rename. The library's HTTP reads use the same helper. When those reads move, put the lookup behind one workspace-scoped playbook service so each handler calls one method, asdocs/internals/effect-services.mdasks. Raised in review of #524.feat(j5): J5's client actions run over WebSocket methods, with permis…
feat(j5): J5's client reads run over WebSocket methods
Jacksondr5 commentedon Oct 13, 2026
Step 3 is in review as a two-PR stack (GitHub stack pingdotgg#587):
Decided with Jackson, 2026-10-11: follow upstream's own rule. A small read is a socket query; a large, compressible payload stays on HTTP. So reading one artifact's content stays an HTTP route (it can be megabytes).
What that leaves for step 4
environmentHttpAuth.ts(FORK.md case 34) stays, with artifact read as its only caller. Removing it means adding that route to upstream's typed HTTP API, which is a new edit to an upstream contract file. That is the open question in refactor(j5): move Squadron and inbox routes to a typed HttpApiGroup #137; nothing else is left for refactor(j5): move Squadron and inbox routes to a typed HttpApiGroup #137.GET /api/j5/a2a/peersstays for thej5 a2a peer listCLI.Left alone on purpose
j5ProjectLedgeris still asked the sidebar's row reads, the archive preflight and the artifact list, and answers "Unknown request tag", as it answered 404 before.feat(j5): J5's read models follow a change stream, not timers
Jacksondr5 commentedon Oct 13, 2026
Update: the two timers listed above as left alone are removed by a third PR on the stack, #593, at Jackson's request. It adds a
peersrevision to the change stream and has the playbook store watch the definition files of active runs. After the stack, J5's client code has no read timers. Still left alone: a server withoutj5ProjectLedgerbeing asked the sidebar's row reads, the archive preflight and the artifact list.feat(j5): J5's client reads run over WebSocket methods (#584)
feat(j5): J5's read models follow a change stream, not timers (#586)
feat(j5): the peer list and playbook boards follow change signals (#593)
Jacksondr5 commentedon Oct 13, 2026
Done. Steps 1 and 2 landed in #524, step 3 in #584, #586 and #593. For step 4, Jackson decided on 2026-10-13 to keep the raw HTTP helper (FORK.md case 34) for its one remaining caller, the read of an artifact's content, and #137 is closed with that decision. J5's client code has no read timers, and the only J5 routes left on HTTP are artifact read, the peer-server routes, the machine-sender routes and the three the
j5 a2a peerCLI calls.