Repository navigation
org: let the team set who approves a tool call and who starts a chat that is not running - #2927
Merged
Merged
Conversation
…at that is not running The organization's policy has a `chats` section beside `hosting`, which so far held one rule, `move_by`. Two more rules for a chat that runs on the organization's own server and is shared with other people become settings there, each optional, each reading as what the server did before it existed: - `chats.approvals_by`: `owner` (also what an absent value means) or `answer`. The wire that enforces it is the next commit. - `chats.wake_by`: `view` (also what an absent value means), `run` or `owner`. Same. Both are validated when the policy is written (422 with a sentence that names the allowed words), written under `chats` by their own names, and absent from the default policy's JSON, so a policy stored before they existed reads and saves unchanged. Tests: TestChatApprovalAndWakeRulesAreTodaysBehaviourUntilTheOrganizationChangesThem, TestChatApprovalAndWakeRulesTakeOnlyTheirWords (acl), TestOrgPolicyStoredWithoutApprovalAndWakeRulesReadsAsToday (store). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…approvals_by lets an organization allow it
The hosted-chat guest wire checks each call a shared chat's guest sends against a table of methods and the verb each one
needs. The table keeps the tool-approval frame, `ResolveConsent`, with the owner under every role, and the docs said a
command that needs approval waits for the owner. But a tool approval is also a question the chat asks, and the answer to
any question is `ResolveQuestion`, which the table lets a person who holds `answer` send (the `edit` role does). Its
payload names the question's kind, and the guest wire never looked: an `edit` guest could send an answer of kind
`consent` with the key for "allow once" or "allow always" and the chat ran the command as its owner. Seen through the
real wire in TestApprovalsByOwnerKeepsAToolApprovalWithTheOwnerOnEveryDoor, which fails on the code before this commit.
Now the wire reads a `ResolveQuestion` payload with the engine's own decoder into the engine's own type, and a consent
answer follows the new policy setting `chats.approvals_by`:
- `owner`, also what an absent setting means: refused with the sentence the older frame already gets ("This chat is
shared with you. Only its owner can do that."). Every other answer, and every other call, is unchanged.
- `answer`: a person who holds `answer` may allow one call once, or refuse it, through either door. Allowing a tool for
the rest of the chat, putting the approval away, revising an answer and the chat's own approval setting stay with the
owner. A person who cannot answer is still told so in the words they always read.
The setting is read again on every heartbeat with the verbs, so a policy change reaches a window that is already open.
A guest's approval is noted as the chat's latest asker, the way an answer already was.
Tests: TestApprovalsByOwnerKeepsAToolApprovalWithTheOwnerOnEveryDoor,
TestApprovalsByAnswerLetsAnAnswererAllowOnceOrRefuseAndNothingWider, TestApprovalsByReachesAnOpenWindowOnTheNextHeartbeat,
TestApprovalsByAnswerNamesTheApproverAsTheAsker, TestChatsSettingsAreValidatedAndShownByThePolicy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat is not running Opening a shared chat that is not running starts it, for its owner and in their place among the chats they may have running. Today anyone who can see the chat does that, and a `view` guest's `codeaf chat --org --once` is one way: it starts the chat in one-shot mode and is then refused when it tries to send, and the owner's own window reads "already open in a different interactive or headless mode" until the chat stops or idles. The organization's policy now has `chats.wake_by`: - `view`, also what an absent setting means: anyone who can see the chat opens it. Nothing changes, and the organization server asks the chats' host for nothing it did not ask for before. - `run`: only a person who may send messages in the chat starts it. A person who can only watch is told "This chat is not running. Starting it takes permission to send messages in it. Ask its owner." and the host's wire door is never reached, so nothing is started. - `owner`: only the chat's owner starts it (a bot acting for them does not count). Others read "This chat is not running. Only its owner can start it. Ask them to open it." A chat that is already running opens for everyone who can see it under every setting. The owner's own window is the byte-copying proxy and no setting touches it. If the chat's state cannot be read, a restricted setting refuses with the "not answering" sentence instead of guessing. The rule is checked when the window opens; a chat that stops in the instant between the check and the connection can still be started by the guest. Tests: TestWakeByViewIsTodaysBehaviourAndAsksTheHostNothingExtra, TestWakeByRunKeepsAWatcherFromStartingAChatThatIsNotRunning, TestWakeByOwnerLeavesStartingAChatToItsOwner, TestWakeByTurnsBackToViewAndOpensTheChatAgain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestWakeByDoesNotLetABotWithoutRunStartItsCreatorsChat: a view-scoped bot is refused on its creator's chat that is not running under both owner and run, and a bot that may run chats starts it under run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nto the manual docs/organizations.md and deploy/org/README.md describe both settings where the policy is described, and the two known limits that mention them (a guest's `--once` starting a chat for its owner, and a tool approval staying with the owner) now say what the setting changes. The app protocol's policy shape lists the two fields. The chat's own manual has a section for each setting on the hosted-chats page, in the words someone would ask with, and the refusal, keyboard and sharing sections name the new sentences. Probes keep each question on its page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 25, 2026
…e owner, and two policy settings loosen that Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbirAbbas
added a commit
that referenced
this pull request
Nov 25, 2026
…ack (#2903) The hosted organisation line: a team-mode org server deciding every request through one access model (verbs, roles, grants and policy in SQLite), hosted chats run by the sessionhost under a per-chat uid inside a Landlock fence with minted model bearers, sealed keys and a git helper, shared chats acting through verbs, bots owned by their creator, the Hosting and chats policy settings, and a self-hosting stack (deploy/org Docker Compose, published images behind a leak gate, a Railway path). Consolidates #2894 #2895 #2896 #2898 #2899 #2900 and the follow-ups #2904 #2905 #2907 #2908 #2910 #2911 #2912 #2913 #2915 #2916 #2918 #2927 #2936 #2944. Proven by the full suite, a keyless Compose smoke, a hostile wire client, sandbox escape probes, a real-model run and a production-style install from the published images. Co-Authored-By: Santosh kumar <29346072+santoshkumarradha@users.noreply.github.com> Co-Authored-By: ZeroPoint95 <329227198+ZeroPoint95@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft, base
org/main(the hosted org feature line, #2903). Not fordev.The owner left four product choices on the hosted org line to the team and asked that they be adjustable without changing today's behaviour. Two of them get a policy setting, two do not. One of them turned out to hide a hole, which this PR closes.
The hole. The docs said a command that needs approval waits for the owner. That was true for the
ResolveConsentframe only. A guest holdinganswer(theeditrole) could send the chat's approval question an answer throughResolveQuestion, whose payload names the question's kind, and the guest wire never read it. The chat then ran the command as its owner. The first test below fails on the old pump. It is its own commit (a6f85d0) so it can be separated. This is the one place the default is not byte-for-byte what the code did, only what the docs said.The settings (both under the policy's
chatssection besidemove_by, optional, validated, absent from the default policy's JSON):chats.approvals_by:owner(default) oranswer. Withanswer, a person who holdsanswermay allow one tool call once or refuse it. Allowing a tool for the rest of the chat stays with the owner.chats.wake_by:view(default, today),runorowner. Controls who may start a shared chat that is not running. Anyone else is told to ask its owner and nothing is started.Operators set them with
PUT /v1/org/policy.Validation contract
GET /v1/org/policyshows the setting once set.Tests, by contract item:
ownerkeep both approval doors with the owner:TestApprovalsByOwnerKeepsAToolApprovalWithTheOwnerOnEveryDooranswerlets allow-once and refuse through and nothing wider:TestApprovalsByAnswerLetsAnAnswererAllowOnceOrRefuseAndNothingWiderTestApprovalsByReachesAnOpenWindowOnTheNextHeartbeatTestApprovalsByAnswerNamesTheApproverAsTheAskerTestChatsSettingsAreValidatedAndShownByThePolicy,TestChatApprovalAndWakeRulesAreTodaysBehaviourUntilTheOrganizationChangesThem,TestChatApprovalAndWakeRulesTakeOnlyTheirWords,TestOrgPolicyStoredWithoutApprovalAndWakeRulesReadsAsTodaywake_bydefault asks the host nothing extra:TestWakeByViewIsTodaysBehaviourAndAsksTheHostNothingExtrarun,owner, turning it back, bots:TestWakeByRunKeepsAWatcherFromStartingAChatThatIsNotRunning,TestWakeByOwnerLeavesStartingAChatToItsOwner,TestWakeByTurnsBackToViewAndOpensTheChatAgain,TestWakeByDoesNotLetABotWithoutRunStartItsCreatorsChatTestHostedChatQuestionsReachTheirPageDocs:
docs/organizations.md,deploy/org/README.md,docs/design/app-v3/PROTOCOL.md, and two new sections in the chat manual (organization-hosted-sessions.md).The four choices
chats.approvals_by:owner(default),answerviewguest's--onceincludedchats.wake_by:view(default),run,owner. The--oncelock-out under the default is not fixedGates
Local, niced:
make pr-ready BASE=origin/org/mainexit 0 (build, vet on linux and windows, gofmt, packed manual, change entry, the manual gates, the laws, then fresh tests of the touched packages:internal/factory/acl,serve(350 s),store,internal/manual). The change entry passesmake changelog-check. No fullinternal/tui3orinternal/sessionsuite was run.🤖 Generated with Claude Code