Skip to content

feat(j5): anyone who can write to the asking thread can allow a refused persona once - #1290

Merged
Jacksondr5 merged 5 commits into
j5/mainfrom
j5code/1284-allow-once-thread-writers
Nov 28, 2026
Merged

Jacksondr5 merged 5 commits into
j5/mainfrom
j5code/1284-allow-once-thread-writers

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Problem

Only an Owner could press Allow this once on a refused persona (allowPersonaOnce needed settings:write). Yet a Collaborator who drives a thread can already @persona that same persona there and get its saved access and models. So in a Collaborator's thread, the agent asked the Collaborator, the Collaborator saw no button, and no grant could follow. Jackson decided on 2026-11-28 that anyone who could pick the persona themselves can allow their agent's pick once.

Closes #1284

What changed

  • Precondition checked first. A Collaborator's @persona message passes command admission at thread scope (message.dispatch → collaborator on the thread). turnPickSource (apps/server/src/j5/agents/agentPersonaPick.ts) counts it as a person's pick, so it runs with no limits.
  • Server. allowPersonaOnce now needs orchestration:operate. The handler (apps/server/src/j5/a2a/clientActionRpc.ts) runs the existing requireWrites against the asking agent's thread, which it reads from the exchange's sender_id. When a Captain asks for a member, that is the Captain's thread. Anyone who can't write to it is refused with the usual "You cannot write to this thread". The grant path itself (grantable, markGranted with grantedBy) is unchanged and still records who granted it. The access gate (apps/server/src/j5/sharing/AccessGate.ts) now lets a narrowed session reach the method, as it does answerHumanExchange; live testing caught that it was missing.
  • Clients. The guarded scope in packages/contracts/src/j5/clientRpcPermissions.ts follows the server, so the existing permissionAtom shows the button to Collaborators on web, desktop and mobile. Save persona stays Owner-only. OwnerAskAction keeps its name; only its comments changed.
  • Model-facing text. The refusal text (personaBlockText), the persona tools' shared rule (BLOCKED_PERSONA_TOOL_TEXT), the allow_once refusal, j5_send_message's escalation_id description and the J5 agent instructions no longer say "an Owner". The refusal and the instructions tell the agent to ask the person driving its thread.
  • Agent context budget. The instructions grow 14 B and the tool list 4 B. agentContextBudget.json and FORK.md case 110 record the new numbers.
  • Docs. docs/j5/product/agent-personas/index.md (Allow this once bullet, plus a History line), docs/j5/user/personas.md, the allow_once sentence in docs/j5/product/features/crews.md, and docs/j5/product/a2a/agent-tools.md, which quotes the tool text.

Tests. A new case in crewAccessRpc.test.ts runs the real handler over real people and levels. A Collaborator on the asking thread is allowed; a Viewer of it and a Collaborator on a seat beneath it are refused. It fails on j5/main with "Only an Owner of this server…". A gate assertion in AccessGate.test.ts shows a thread-scoped Collaborator reaches the handler. The existing scope tables and string assertions are updated to match.

Evals (Jackson approved, subscriptions only). A new guard case, j5-refused-persona-asks-the-person in evals/j5-cli/cases/persona-and-fork.ndjson, has the agent pick a persona itself and get the branch's refusal text back. It must ask the person with j5_send_message (expect_reply, escalation_id), and must not recreate the persona as a custom or plain worker or retry with an allow_once nobody granted. On evals/j5-cli, with the new case plus the three existing persona-and-fork cases, it passed 8/8 on claude-sonnet-5-5 and 8/8 on gpt-6.1-sol. A j5/main baseline of the new case, run with the old wording, passed 2/2 on each model.

UI changes

A project Collaborator's Inbox ask carrying J5's record of a refused persona. Before, there is no button; after, Allow this once is there for them.

Before After
Collaborator Inbox with recorded persona block, before Collaborator Inbox with Allow this once, after

The action area, enlarged.

Before After
Collaborator persona permission actions, before Collaborator persona permission actions with Allow this once, after

The Collaborator allows the launch; the Inbox ask closes and the agent retries the persona successfully.

collaborator-allows-once.mp4

Live testing

Web: PASS on 76900fe9f3, by the Crew's web tester (GPT-6.1 Sol), on a test home from setup-agent-live-test.ts. Before was captured on 42079472b0 (j5/main).

  1. A project Collaborator with no server role drove a Supervised thread. A real Haiku turn picked a Full-access persona with no @persona mention and was refused models_exhausted (waivable access-above-caller). It then asked the Collaborator with the escalation id.
  2. Before: the ask showed J5's recorded block and no button.
  3. After, on the same home and the same open ask: the button showed. Pressing it closed the ask with "Allowed once: …".
  4. The escalation row went to granted with granted_by set to the Collaborator's person id. The agent retried with that allow_once, the Haiku child completed its task, and the row went to used, still granted by the Collaborator.

The first run, on fa25e8bf93, found the access-gate refusal that 76900fe9f3 fixes. The re-test paired a new browser device to the same person and used the same open ask.

The head, 8f47fbf940, is 76900fe9f3 rebased onto j5/main after #1288. The only conflict was a History line in docs/j5/product/agent-personas/index.md, and both lines are kept. No code changed, so I did not re-test it live; check:changed passes on the head.

Not exercised live:

  • A Viewer on the same ask. The test's Viewer showed no button in their own thread, but they never received that ask. The handler test covers the refusal.
  • Desktop, which wraps the same web component.
  • Mobile, which reads the same shared permission table through its existing Inbox support. I left it out because the change is one scope entry shared by every client, and the server check is the same.

Upstream impact

  • apps/server/src/provider/agentContextBudget.json: FORK.md case 110 (data; numbers updated in the case text).

No change to what upstream's product does.

Checklist

  • One concern: the description has no "also"
  • 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 (none: J5-only)
  • Surfaces: entry points (Inbox page and the ask above the composer share OwnerAskAction), clients (web, desktop, mobile through the shared permission table), contracts, agents (tool text and instructions). Reverse state: none needed, since a grant is single-use.
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them

Built by Claude Opus 5.5 in Claude Code (J5 Code), as the #1284 builder seat.

🤖 Generated with Claude Code

@Jacksondr5
Jacksondr5 marked this pull request as draft November 28, 2026 22:02
@vercel

vercel Bot commented Nov 28, 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 Nov 28, 2026 11:01pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 97db7c4 and a1bd4a9.

Files selected for processing: 26

  • FORK.md
  • apps/mobile/src/j5/inbox/OwnerAskAction.tsx
  • apps/server/src/j5/a2a/ClientActionsService.ts
  • apps/server/src/j5/a2a/clientActionRpc.ts
  • apps/server/src/j5/a2a/crewAccessRpc.test.ts
  • apps/server/src/j5/a2a/mcp/tools.ts
  • apps/server/src/j5/agents/agentInvocation.test.ts
  • apps/server/src/j5/agents/agentPersonaEscalation.test.ts
  • apps/server/src/j5/agents/agentPersonaEscalation.ts
  • apps/server/src/j5/sharing/AccessGate.test.ts
  • apps/server/src/j5/sharing/AccessGate.ts
  • apps/server/src/j5/wsRpc.test.ts
  • apps/server/src/provider/agentContextBudget.json
  • apps/web/src/j5/a2a/OwnerAskAction.tsx
  • apps/web/src/j5/a2a/humanInboxClient.ts
  • docs/j5/product/a2a/agent-tools.md
  • docs/j5/product/agent-personas/index.md
  • docs/j5/product/features/crews.md
  • docs/j5/user/personas.md
  • evals/j5-cli/cases/persona-and-fork.ndjson
  • packages/client-runtime/src/j5/inbox.test.ts
  • packages/client-runtime/src/j5/inbox.ts
  • packages/contracts/src/j5.ts
  • packages/contracts/src/j5/clientRpcPermissions.test.ts
  • packages/contracts/src/j5/clientRpcPermissions.ts
  • packages/provider-core/src/j5/orchestrationInstructions.ts
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added the vouch:trusted Author is trusted by repo permissions or the VOUCHED list. label Nov 28, 2026
@github-actions github-actions Bot added the size:M 30-99 effective changed lines (test files excluded in mixed PRs). label Nov 28, 2026
@Jacksondr5
Jacksondr5 marked this pull request as ready for review November 28, 2026 22:18
@Jacksondr5
Jacksondr5 marked this pull request as draft November 28, 2026 22:18
@Jacksondr5
Jacksondr5 force-pushed the j5code/1284-allow-once-thread-writers branch from 76900fe to 8f47fbf Compare November 28, 2026 22:20
@Jacksondr5
Jacksondr5 marked this pull request as ready for review November 28, 2026 22:37
@Jacksondr5
Jacksondr5 enabled auto-merge (squash) November 28, 2026 22:37
@Jacksondr5

Copy link
Copy Markdown
Owner Author

CodeRabbit hit its free review limit on this PR, so here is the Captain's review of the permission change at f358421b86.

  • Server check (clientActionRpc.ts, writesAskingThread): it looks up the ask's sender and runs the existing requireWrites on that sender's thread.
  • Access gate (AccessGate.ts): allowPersonaOnce is now narrowed, like answerHumanExchange. This is the defect the first live pass caught.
  • Tests (crewAccessRpc.test.ts): a Collaborator on the asking (Captain) thread is allowed. A Viewer there is refused, and so is a Collaborator on a seat's thread. The test fails on j5/main.
  • "Save persona" stays Owner-only, unchanged.
  • Model-facing wording: reviewed with the Director. The evals pass on both the old and the new text, with the results above.

No findings.

Claude Opus 5.5 (Eng Lead).

Jacksondr5 and others added 5 commits November 28, 2026 17:57
…ed persona once

A Collaborator who drives a thread can already @persona any persona there,
but only an Owner could press "Allow this once" on that thread's agent's
blocked pick. allowPersonaOnce now needs operate scope, and the server lets
through whoever writes to the thread of the agent that asked; anyone else
is refused. The grant still records who granted it. Model-facing text,
the personas contract and the user guide say who can allow it.

Closes #1284

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Jacksondr5
Jacksondr5 force-pushed the j5code/1284-allow-once-thread-writers branch from f358421 to a1bd4a9 Compare November 28, 2026 23:01
@Jacksondr5
Jacksondr5 merged commit bcc21e2 into j5/main Nov 28, 2026
39 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/1284-allow-once-thread-writers branch November 28, 2026 23:21

This branch was successfully deployed

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

Labels

size:M 30-99 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.

Personas: anyone who can write to the asking thread can allow a refused persona once

1 participant