Skip to content

org gaps: ignore deploy/org/.env, Compose builds codeaf from source, chats.move_by policy, entry 2900 wording - #2910

Merged
AbirAbbas merged 5 commits into
org/mainfrom
org/gaps
Nov 25, 2026
Merged

AbirAbbas merged 5 commits into
org/mainfrom
org/gaps

Conversation

@AbirAbbas

Copy link
Copy Markdown
Collaborator

Four gaps between what the owner decided and what the code did on the org/main feature line, found by the docs audit (#2908). One commit per item. Draft into org/main; nothing here goes to dev.

What changes

  1. deploy/org/.env can no longer be committed. ./setup.sh writes it from .env.example and it holds the AgentField key, the organization token, the hosted-chats secret, the server key and the model keys; no .gitignore named it. deploy/org/.gitignore now ignores .env and any other .env.* copy, and keeps .env.example, .env.stub and .env.stub.hosted tracked. The image builds already excluded it (.dockerignore, codeaf.Dockerfile.dockerignore).
  2. A plain docker compose up --build runs hosted chats. The codeaf, runner and sessionhost services now share one build whose CODEAF_BINARY_FROM defaults to source (this checkout, repository root as context). fetch and local stay opt-in. No release has codeaf sessionhost yet, so the old fetch default produced a stack that could not run hosted chats. compose.yaml says when to flip it back and how to tell: the pinned release's codeaf sessionhost --help.
  3. Who may move a chat is a policy setting. chats.move_by is owner (default, and what an absent value means) or manage. Default behaviour and the refusal sentence are unchanged; with manage, a holder of the manage verb can move the chat, an edit holder still cannot, a bot never can. One guard comes with the opt-in: a person who is not the owner cannot move the chat into their own My space.
  4. Change entry 2900 said stopping a hosted chat stays the owner's whatever the role. The code lets a manage holder (the full role) stop and delete it, which is the owner's deliberate grant. The entry now says that; the code is unchanged.

Validation contract

  • git check-ignore deploy/org/.env matches; the three templates are not ignored; git status stays clean after ./setup.sh creates .env.
  • Built with no variables set, the codeaf image answers codeaf sessionhost --help with the sessionhost's own message (CODEAF_SESSIONHOST_SECRET must be at least 32 characters long); the pinned release says there is no codeaf sessionhost.
  • Default policy: a manage holder is refused with Only the person who owns this chat can move it, and they need permission to manage it. Opted in: a manage holder can move the chat and an edit holder cannot. A policy document stored before the field existed reads as owner-only and the default policy's JSON has no chats key.
  • The manual's sharing page has a section on the rule; deploy/org/README.md lists the field.

Tests and proof

  • acl: TestChatMoveRuleIsOwnerOnlyUntilTheOrganizationChangesIt, TestChatMoveRuleTakesOnlyItsTwoWords
  • store: TestOrgPolicyStoredWithoutChatRulesReadsAsOwnerOnlyMove
  • serve: TestChatMoveDefaultPolicyRefusesAManageHolder, TestChatMoveManagePolicyLetsAManageHolderMoveButNotAnEditHolder, TestChatMoveManagePolicyKeepsAnotherPersonsChatOutOfTheMoversSpace, TestChatMoveRuleTurnsBackToOwnerOnly, TestChatMoveRuleIsTheOperatorsToSetAndTakesTwoWords, and the existing TestContractI* and TestAccessPolicyAPI still pass
  • manual: the chat manual probe table, with two new probes
  • deploy/org/gate/context-check.sh passes (17 planted files, including deploy/org/.env, kept out of the build context) with the repository root as context
  • one codeaf image built through Compose with the default, codeaf sessionhost --help run inside it, image removed

For whoever merges this and #2908

#2908's "Secrets" paragraph in deploy/org/README.md says no rule keeps .env out of git and tells the operator to add one. After this PR that is no longer true: .env is ignored. The two PRs also touch nearby lines of deploy/org/README.md, organization-sharing.md and chat_test.go, so the second to merge needs a small rebase.

🤖 Generated with Claude Code

AbirAbbas and others added 5 commits November 24, 2026 22:16
setup.sh writes deploy/org/.env from .env.example, and that file holds the AgentField key, the
organization token, the hosted-chats secret, the server key and the model keys. Neither the root
.gitignore nor deploy/org/.gitignore named it, so a `git add` of the folder would have published
all of them. The image builds already left it out (.dockerignore and
codeaf.Dockerfile.dockerignore, which gate/context-check.sh proves by planting one); this closes
the git side.

The templates stay tracked: .env.example, .env.stub and .env.stub.hosted. Any other .env.* copy,
a backup or a second environment, is ignored too.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…sted chats run out of the box

compose.yaml built the codeaf image with CODEAF_BINARY_FROM defaulting to `fetch`, which downloads
the pinned release. No release has `codeaf sessionhost` yet, so a plain `docker compose up
--build` produced a stack that could not run hosted chats. The three services that run the codeaf
image (codeaf, runner, sessionhost) now share one build, `x-codeaf-build`, whose default is
`source`: the binary is built from this checkout, the same build the published image is made
from. That needs the repository root as the build context, so the build says so, and
codeaf.Dockerfile.dockerignore lets the local-binary file in under that path too.

`fetch` and `local` remain opt-in. The Dockerfile's own default stays `fetch`, because built by
hand from deploy/org it has no source to build from. compose.yaml says when to flip the default
back: once the release pinned in codeaf.Dockerfile answers `codeaf sessionhost --help`.

README.md "Start it", "Turning it on" step 3 and the Railway note, and the headers of
codeaf.Dockerfile and smoke.sh, no longer say that a plain build fetches the release.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…sted chat

The entry said stopping a hosted chat stays the owner's whatever the role. The code lets anyone
holding `manage` do it (hostedEnd in internal/factory/serve/hosted_proxy.go checks the manage verb,
which the owner and the `full` role hold), and TestP2_7_HostedStopAndDeleteRequireManage has a
person the chat is shared with at `full` stop it. The owner granting `full` is deliberate, so the
entry now says what the code does; the code is unchanged. What stays the owner's on the wire is
approving a command, settings and files.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…y by default

Moving a chat was hard-coded to its owner (CodeAF #2890). Abir's call on 2026-11-24 was "owner-only
move (configurable)", so the rule is now a policy setting, `chats.move_by`, beside `hosting`:

- `owner` (also what an absent or empty value means): only the person who owns the chat moves it,
  and still needs manage on it. A policy stored before the field existed reads this way, and the
  default policy's JSON does not change, so behaviour and the refusal sentence are as they were.
- `manage`: anyone who holds the manage verb on the chat can move it, which under the starting
  roles is whoever it is shared with at `full`. `edit` still cannot, a bot never can, and the chat
  stays its owner's.

One guard comes with the opt-in: a person who is not the owner can move the chat into a workstream
they can edit, never into their own My space, because the chat would then leave the place its owner
keeps it and every grant on it would be dropped. Under the default that case cannot arise.

The setting accepts only its two words (422 otherwise). The manual's sharing page has a section on
it, with probes; deploy/org/README.md's policy reference and the app protocol's policy shape list
the field.

Tests: TestChatMoveRuleIsOwnerOnlyUntilTheOrganizationChangesIt, TestChatMoveRuleTakesOnlyItsTwoWords
(acl), TestOrgPolicyStoredWithoutChatRulesReadsAsOwnerOnlyMove (store),
TestChatMoveDefaultPolicyRefusesAManageHolder,
TestChatMoveManagePolicyLetsAManageHolderMoveButNotAnEditHolder,
TestChatMoveManagePolicyKeepsAnotherPersonsChatOutOfTheMoversSpace,
TestChatMoveRuleTurnsBackToOwnerOnly and TestChatMoveRuleIsTheOperatorsToSetAndTakesTwoWords (serve).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@AbirAbbas
AbirAbbas merged commit 0c25d47 into org/main Nov 25, 2026
7 checks passed
@AbirAbbas
AbirAbbas deleted the org/gaps branch November 25, 2026 04:01
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 <[email protected]>
Co-Authored-By: ZeroPoint95 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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