Skip to content

feat(j5): a guest's client reads a thread at the level it was granted - #577

Merged
Jacksondr5 merged 8 commits into
j5code/share-2-guest-filterfrom
j5code/share-2b-guest-client
Oct 13, 2026
Merged

Jacksondr5 merged 8 commits into
j5code/share-2-guest-filterfrom
j5code/share-2b-guest-client

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Problem

A guest's client decided "can you send?" from one server-wide permission, so it could not tell a thread shared at View from one shared at Collaborate. J5's own views also kept asking a shared server for things a guest is always refused, and showed the refusals (an inbox "?" badge, refused reads every 7.5 seconds). Part of #532 / #533.

What changed

The server tells the client. A new J5 RPC group, j5.sharing (packages/contracts/src/j5/sharing.ts):

  • getConnectionAccess says whether the connection is a member's or a guest's. A client asks once per connection, in the background: nothing a member's client does waits on the answer, and a server that cannot answer is treated as having no guests.
  • subscribeThreadAccess gives a guest its level on one thread, and sends it again when a grant changes it. Only a guest's client opens it. The level comes from PersonAccess.watchThreadAccess, so it covers the agents beneath a granted thread and threads of a granted project; the client never works a level out from grants.

Both are allowed for a guest in GUEST_RPC_RULES and answer only for the session the socket was opened with.

One call in each chat view, and in the web thread action menu. Where upstream's web ChatView.tsx and mobile ThreadRouteScreen.tsx read the "Operate tasks" permission, they now call J5's useCanOperateThread(environmentId, threadId). It returns upstream's answer for a member, and for a guest also requires Collaborate on that thread. While the server has not yet said which kind the connection is, nothing is withheld, so a member's composer never flickers.

Quiet J5 surfaces. J5's reads (inbox and its count, Crew proposals and approvals, Fleet, Playbooks, Crew chips and spawned children on sidebar rows) stop once a connection is known to be a guest's: they report the server as one without the feature, which is never polled, and an earlier refusal leaves no error on screen. A guest's client may send one first round of these before it knows, which the server refuses. A member's reads go out exactly as before. J5's Personas and Playbooks pages leave out a server the person is a guest on, and say "Personas and Playbooks are not available on a server you are a guest on." when there is no other server.

Images and files in a granted thread. A guest may now ask assets.createUrl for a message attachment or a tool's inline image, and only when the server's own records put it in a thread the guest's grants cover (PersonAccess.messageAssetAccess: the attachment id must be in a message's attachment list, or the turn item must be stored under the thread named). Workspace, media and draft-workspace files, project favicons, GitHub media and native app icons stay refused. The URL is upstream's signed token for that one asset; /api/assets serves only what the token's signed claims name.

One sidebar path for a guest (changes #561). The HTTP sidebar snapshot is refused to a guest, and upstream's client falls back to the socket's feed, which was already filtered. shellSnapshotFor and the edit to upstream's orchestration-v2/http.ts are gone.

A reduced provider list for a guest (changes what #561 gives a guest). #561 gave a guest no providers. With none, upstream's composer shows its setup state, tells a guest to "Enable a provider in Settings" and offers a settings button, and the per-thread level cannot show through it. GuestView.reduceServerConfig now gives a guest every enabled provider, built field by field. A guest receives exactly:

  • per provider: instanceId, driver, displayName, and models; plus fixed values the schema requires: enabled: true, installed: true, version: null, status: "ready", auth: { status: "unknown" }, a placeholder checkedAt, slashCommands: [], skills: [];
  • per model: slug, name, shortName, subProvider, isCustom, isDefault, isLegacy, capabilities.

Nothing of a provider's sign-in (email, label, plan, profile), version or update state, health or messages, paths, usage, skills, commands, icons or setup links is sent. Disabled providers are left out. Later provider updates on the configuration feed are still dropped. The list does not depend on the guest's grants.

What a View guest still sees (not fixed here)

The single call covers the composer's send, queue, steer and stop, approvals and question prompts, and the snooze/settle banners. Everything below reads upstream's server-wide permission elsewhere, so it is still offered, and the server refuses it:

Control What a View guest sees today
Composer Upstream's read-only state: the normal composer with send disabled and labelled "This connection cannot change threads."; Enter does nothing and no error appears (seen live). It looks like a working composer until the send button is hovered or pressed
Model and access mode pickers The thread's model and access mode are shown. The pickers still open, and picking a model changes the guest's own unsent selection in their browser (seen live); it reaches nothing on the server. The definition says "shown and cannot be changed", so this is short of it
Rename by double-clicking the thread title Still starts for a View guest (the header reads the server-wide permission); the server refuses it on submit. From code, not pressed
Header menu: Mark unread, Copy, Project settings Still enabled: upstream lists these as needing no permission. Mark unread, pressed live, showed no error. Rename, Archive, Delete and the other changing actions are now shown disabled
Fork from a response Offered; inline error "This is not shared with you on this server." (seen live)
Git: Commit, Select ref, Changes Commit and Select ref disabled; Changes enabled, not pressed
Terminal drawer toggle Offered; nothing opens (seen live)
Open in editor Disabled; "No installed editors found"
Add project script, Manage scheduled tasks, New thread, Add project, Settings Offered; not pressed. Automations shows "Could not load automations: This is not shared with you on this server."
File browser / right panel Offered; not pressed
Approval and question prompts Not seen live (no fixture has one pending). From code: both receive the same canOperateThread
Mobile: thread rows' swipe and menu actions Still offered; each row reads the server-wide permission (thread-list-v2-items.tsx). From code, mobile was not run
Pages and documents a tool published (html_render, MCP Apps) Not served to a guest: they are attachments of a tool call, not of a message, and are not tied to a thread by this check
A signed asset URL Keeps working for up to an hour after a grant is removed (upstream's token lifetime; the route is unauthenticated)

Upstream requests a guest's client still sends and has refused (left alone): vcs.listRefs (retries, capped at 30 s), server.reportClientActivity (every 25 s), subscribeVcsStatus, subscribeDeviceState, server.discoverSourceControl, projects.readFile, assets.createUrl, server.refreshProviders, scheduledTasks.subscribe, orchestration.getArchivedShellSnapshot, one orchestration.dispatchCommand on opening a thread, and POST /api/observability/v1/traces.

UI changes

Before After
A View guest's granted thread before after
The guest's composer. Before, it asks the guest to enable a provider; after, it is upstream's read-only composer, with the thread's model shown and send disabled before after
The guest's sidebar and rail. Before, the inbox shows a "?" badge from refused reads; after, it is quiet, and the thread's provider mark shows before after
An image attached to a message, as a guest. Before, an inert filename tile; after, the image before after
The Personas page as a guest. Before, creation controls beside refusals; after, a plain notice before after
The thread action menu as a View guest. Before, every action offered; after, Rename, Archive and Delete disabled before after
The thread action menu as a member, unchanged before after
A member's view of the same thread, unchanged before after

Not captured: the send button's "This connection cannot change threads." label (a tooltip); a Collaborate guest; mobile.

Live testing

Report: artifacts/test-reports/j5code-share-2b-guest-client.md. Verdict: pass. Run by the builder with the j5-live-test skill, a member and a hand-made View guest on the same server; the base server (--base j5code/share-2-guest-filter) gave the before state. The last pass ran on the tree of b86bcfc835.

  • Seen live: the View guest's thread action menu shows Rename, Archive and Delete disabled, with Mark unread, Copy and Project settings left, and a member's menu is the same on base and head; a guest's client connects, lists its granted thread and shows no error while GET /api/orchestration/shell answers it 403 (server log); the image attached to a granted thread's message renders for the guest (it loads from /api/assets, 200), where the base shows a filename tile; the Personas page shows the plain notice with no controls; the guest's first round of J5 reads is refused once per page load (Fleet, inbox count, Crew proposals) and none follows, with no badge or error left; the composer is upstream's read-only one; a member's thread, inbox count, Fleet and Crew chips are unchanged, and a member's Haiku turns completed.
  • Seen live in the earlier pass only, with an uncommitted scratch change (grant changes republished after a direct database write, since no route changes a grant yet): Collaborate enables send, and lowering the grant to View disables it again without a reload.
  • By test only: that a member's reads do not wait when the server never answers the sharing question; View on one thread and Collaborate on another; the hostile asset requests (another thread's attachment, an id no message carries, a made-up id, another thread's tool image, another thread's item named under the granted thread, each path-keyed kind, a removed grant); the feed beginning again for a granted thread in a project not yet sent; a grant that cannot be read ending the feed with nothing sent; what a guest's provider entries contain.
  • Not exercised: mobile (typecheck only); a non-image file attachment; a tool's inline image; pending approval and question prompts as a guest; relay and tunnel connections.

Upstream impact

Decisions: Jackson, 2026-10-12, per-thread levels and the thread action menu (#532); register D33 extended. All under FORK.md case 69. After this PR the whole stack edits eight upstream files: these seven (ws.ts also carries #561's wrapping calls) and apps/server/src/server.ts from #561.

Upstream file Edit
apps/web/src/components/ChatView.tsx one import, one call replaced
apps/web/src/hooks/useThreadActionMenu.ts one import, one call replaced (the file already carries J5's case 21)
apps/mobile/src/features/threads/ThreadRouteScreen.tsx one import, one call replaced
packages/contracts/src/rpc.ts one import, one .merge(J5SharingRpcGroup)
packages/client-runtime/src/rpc/client.ts one import name, one subscription tag
packages/client-runtime/package.json one export, ./j5/sharing
apps/server/src/ws.ts one argument added to the existing layerJ5WsRpc(...) call
apps/server/src/orchestration-v2/http.ts #561's edit reverted; the file equals upstream's again

Checklist

  • One concern: the reduced provider list changes feat(server): a guest's connection reaches only what its grants cover #561's server answer in the client PR, on the stack owner's instruction, because the read-only composer cannot show without it
  • Tests cover the changed behavior (backend changes ship with focused tests)
  • UI changes: before/after screenshots above, and a video for motion or interaction
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR
  • Upstream product: any change to what upstream's product does has a human decision linked above and a register entry in docs/j5/product/upstream.md
  • Surfaces: web and mobile share the seam and the silent reads; mobile was not run. Providers, desktop and connection modes are untouched. Agents: not applicable, a guest has no agent door
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them (register D33; no user doc, since no guest can be made yet)

Built by Claude Opus 5.5 in Claude Code (J5 Code).

🤖 Generated with Claude Code

A guest's client decided "can you send?" from one server-wide permission,
so it could not tell a View thread from a Collaborate one, and J5's own
views kept asking a shared server for things a guest is always refused.

The server now tells a connection whether it is a guest's and, for a
guest, its level on each thread it opens, sent again when a grant changes
it. Upstream's chat view makes one call into J5 where it read the
permission, on web and mobile; a member's connection gets upstream's
answer. J5's inbox, Fleet, Crew and Playbook reads are not sent on a
guest's connection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Oct 13, 2026 1:01am UTC

Request Review

@github-actions github-actions Bot added the vouch:trusted Author is trusted by repo permissions or the VOUCHED list. label Oct 12, 2026
Jacksondr5 added a commit that referenced this pull request Oct 12, 2026
@github-actions github-actions Bot added the size:L 100-499 effective changed lines (test files excluded in mixed PRs). label Oct 12, 2026
@Jacksondr5
Jacksondr5 added this pull request to stack #575 October 12, 2026 22:43
A guest's configuration carried no providers, so upstream's composer
showed its setup state and told a guest to enable a provider in Settings.
The per-thread level could not show through it.

A guest is now given each enabled provider's id, kind, display name and
models, built field by field, with nothing of its sign-in, version,
health, paths, usage, skills or commands. A View guest gets upstream's
read-only composer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A member's client no longer waits on the sharing question: J5's reads go
out as before and stop only once a connection is known to be a guest's.

A guest is refused the HTTP sidebar snapshot and reads the sidebar from
the socket's filtered feed, so upstream's orchestration http.ts is no
longer edited. A guest may ask for a URL to an attachment or a tool's
image only when the server's own records put it in a thread its grants
cover. J5's Personas and Playbooks pages leave out a server the person
is a guest on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Jacksondr5 added a commit that referenced this pull request Oct 12, 2026
@github-actions github-actions Bot added size:XL 500-999 effective changed lines (test files excluded in mixed PRs). and removed size:L 100-499 effective changed lines (test files excluded in mixed PRs). labels Oct 12, 2026
The web thread header read the server-wide permission while the chat
view asked J5, so a View guest could start an inline rename from the
title. It now makes the same call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upstream's thread action menu read the server-wide permission when it was
opened, so a View guest was offered Rename, Archive and Delete. It now
asks J5, as the chat view does, and shows them disabled the way upstream
does for a connection without the permission. The thread header is
upstream's file again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…time

Upstream's test of the menu hook mocks `react` with only what the hook
used. The J5 read it now calls lived beside a React hook, so importing it
loaded the connection runtime and failed on the mock. The read is its own
module, and the hook's module hands it a guest's level when it loads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Jacksondr5
Jacksondr5 marked this pull request as ready for review October 13, 2026 01:11
@Jacksondr5
Jacksondr5 merged commit 01bef0d into j5/main Oct 13, 2026
36 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/share-2b-guest-client branch October 13, 2026 01:11
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 37 billable files and costs up to $9.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 59 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 60 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: b45c4a3e-906b-42ec-96d3-845c05074503
📥 Commits

Reviewing files that changed from the base of the PR and between 3fc1eb0 and 655cd32.

📒 Files selected for processing (37)
  • FORK.md
  • apps/mobile/src/features/threads/ThreadRouteScreen.tsx
  • apps/mobile/src/j5/agents/AgentLibrarySettingsScreen.tsx
  • apps/mobile/src/j5/playbooks/PlaybookLibrarySettingsScreen.tsx
  • apps/mobile/src/j5/sharing/guestAccess.ts
  • apps/mobile/src/j5/upstreamSeams.test.ts
  • apps/server/src/j5/sharing/GuestGate.test.ts
  • apps/server/src/j5/sharing/GuestGate.ts
  • apps/server/src/j5/sharing/GuestView.test.ts
  • apps/server/src/j5/sharing/GuestView.ts
  • apps/server/src/j5/sharing/PersonAccess.test.ts
  • apps/server/src/j5/sharing/PersonAccess.ts
  • apps/server/src/j5/sharing/sharingRpc.ts
  • apps/server/src/j5/wsRpc.ts
  • apps/server/src/j5/wsRpcAggregates.ts
  • apps/server/src/j5/wsRpcScopes.ts
  • apps/server/src/orchestration-v2/http.ts
  • apps/server/src/ws.ts
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/hooks/useThreadActionMenu.ts
  • apps/web/src/j5/agents/AgentLibrarySettings.tsx
  • apps/web/src/j5/playbooks/PlaybookLibrarySettings.tsx
  • apps/web/src/j5/sharing/guestAccess.ts
  • apps/web/src/j5/sharing/threadOperability.ts
  • apps/web/src/j5/state.ts
  • apps/web/src/j5/threads/useThreadRowReads.ts
  • docs/j5/product/upstream.md
  • packages/client-runtime/package.json
  • packages/client-runtime/src/j5/readSources.test.ts
  • packages/client-runtime/src/j5/readSources.ts
  • packages/client-runtime/src/j5/sharing.test.ts
  • packages/client-runtime/src/j5/sharing.ts
  • packages/client-runtime/src/j5/state.ts
  • packages/client-runtime/src/rpc/client.ts
  • packages/contracts/src/j5.ts
  • packages/contracts/src/j5/sharing.ts
  • packages/contracts/src/rpc.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Jacksondr5 added a commit that referenced this pull request Oct 13, 2026
Rebased onto guest sharing (#536, #561, #577). The guest gate refuses every
J5 read by default; the client now skips them for a connection it knows is a
guest's, as it did for the HTTP reads, and hides the playbook boards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Jacksondr5 added a commit that referenced this pull request Oct 13, 2026
* feat(j5): J5's client reads run over WebSocket methods

J5's client reads called J5's own HTTP routes, each with its own
authentication, error shape and "is this route missing" probe. Upstream's
rule is that a small read is a socket query and a large, compressible
payload goes over HTTP.

Fourteen reads move to RPC methods: the Inbox list and open count, Crew
proposals, runtime requests and memberships, the Fleet, spawned children,
the archive preflight, participant identities, the peer list, the three
playbook reads and the artifact list. Their routes are removed. Reading
one artifact's content stays on HTTP, because it can be megabytes.

Part of #506 (step 3).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(web): the Artifacts page waits for the socket before listing

The list is read over the socket now, which comes up after the prepared
connection the page waited for, so a direct visit to /artifacts failed as
"not connected" until Try again. Found in live testing.

Review fixes: FORK.md no longer names deleted route files, and says which
views skip an unsupported server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(server): drop an unused import

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(j5): a known guest is sent none of J5's socket reads

Rebased onto guest sharing (#536, #561, #577). The guest gate refuses every
J5 read by default; the client now skips them for a connection it knows is a
guest's, as it did for the HTTP reads, and hides the playbook boards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mobile): the playbook board calls its hooks unconditionally

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Jacksondr5 added a commit that referenced this pull request Nov 23, 2026
Jacksondr5 added a commit that referenced this pull request Nov 23, 2026
Jacksondr5 added a commit that referenced this pull request Nov 23, 2026
Jacksondr5 added a commit that referenced this pull request Nov 23, 2026

This branch was successfully deployed

1 active deployment
Preview — 655cd32d Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant