Repository navigation
One rule decides where a new conversation runs - #1301
Merged
Merged
Conversation
decide_place reads what a creation asked for, its channel's place, the default device and whether it is a person's, an agent's thread or a fork; pool_choice holds the pool's overflow to a cloud VM. An agent's thread naming a place stays in its channel on its parent's approval mode, and a fork runs where its source runs, in its source's channel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcBpmUavSQzUs5aJwmDfpv
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Varuas37
marked this pull request as ready for review
November 10, 2026 15:24
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 10, 2026
Varuas37
added a commit
that referenced
this pull request
Nov 10, 2026
**Before:** - `Environments` answered where a conversation runs, and also held the command policy and how long artifact publish and fetch calls wait. - Its placements store was an `Option`. Production always set it; tests left it empty, so every place, placement and erase call had a "no store" branch. **After:** - `Environments` holds places and the placements store only. The store is required. - The command policy and both waits live in `EnvironmentToolConfig`, held by the conversation service and read by the environment tools, artifact fetch and artifact publish. - Nothing a person or agent sees changes. Closes #1302 ## Background Slice P3 of the plan "Simplify where agents run". P1 (#1293) made one `Place` type, and P2 (#1301) made one rule that decides a new conversation's place. P3 trims `Environments` down to that job. ## The problem Two owners lived in one type: - Code that only needed a wait or the command policy had to reach through `Environments`. - Tests built `Environments` without a store, so production code kept `None` branches that only tests ever took. ## The solution ```mermaid sequenceDiagram participant Comp as composition/local_auth participant Svc as ConversationService participant Env as Environments participant Tools as environment tools / artifacts Comp->>Env: places + placements store (required) Comp->>Svc: EnvironmentToolConfig (Cedar command policy, publish/fetch waits) Tools->>Svc: inner.tool_config.commands / publish_wait / fetch_wait Tools->>Env: which place runs this conversation ``` - **New `application/tool_config.rs`:** `EnvironmentToolConfig { commands, publish_wait, fetch_wait }`. `Default` has no policy and the old `PUBLISH_CALL_WAIT` / `FETCH_CALL_WAIT`, which moved here. - **`ConversationDependencies.tool_config`:** `local_auth.rs` builds it from the Cedar command policy next to the environments. - **`placement.rs`:** the policy and wait fields and their methods are gone, and `placements` is no longer `Option`. The test-only `From<Arc<dyn Environment>>` uses `HereOnlyPlacements`, which reads Here, accepts Here and refuses any other place as `Unavailable`. - **Tests:** the dependency literals take `tool_config: Default::default()`. The lease harness takes the config as an argument, so tests that vary the policy or the waits say so. ## How we checked it - **Library tests:** the full `nessa-server` lib suite gives 4,810 passed. The 6 that fail also fail on main in this sandbox: they need a non-root user (managed_runtimes, codex cleanup, native_hooks ×2, quarantine ×2). - **Clippy:** `cargo clippy -D warnings` passes on Linux, and on Windows through the mingw cross-check. - **Review:** two independent review rounds. Round 1 found no bugs and its low findings are fixed: naming, the here-only store, Windows visibility, and the command artifact deadline still using the publish wait. Round 2 found nothing actionable. - **Stress:** no new step. Nothing a person or agent does behaves differently; the existing gate covers these paths. ## Tradeoffs The plan's P3 also splits Reach into a small Connection trait, with SSH, paired and cloud adapters, and removes `let_go`, `unowned` and the `unreachable!`. That is deferred to C1/C3. Those pieces exist only for the Workspace variant, and workspace-sdk has no Connection trait yet to adapt to. ## Rollout Nothing special. No stored data or wire format changes. --- _Generated by [Claude Code](https://claude.ai/code/session_01JcBpmUavSQzUs5aJwmDfpv)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Varuas37
added a commit
that referenced
this pull request
Nov 11, 2026
**Before:** A channel's main agent and its threads could run only on This Mac, Boat, or (threads only) Any computer. **After:** Either can also run on one named computer: an SSH host the gateway serves or a paired computer. Channel settings and the new-channel flow list those computers, and a computer the gateway does not serve is refused with `channel_place_unavailable`. Closes #1305 ## Background Slice P5 of the plan "Simplify where agents run". P1 (#1293) made one `Place` type, P2 (#1301) one rule that decides a new conversation's place, and P3 (#1303) trimmed `Environments` to places only. A channel keeps two places: one for its main agent (`coordinator`) and one for the threads it starts. ## The problem - The channel store only accepted the words `local`, `boat` and `pool` (SQL `CHECK`s), and the domain refused `pool` for the main agent. - So a person who had a devbox over SSH, or a paired Mac, could pick it for one chat but never make it a channel's home. - The client also rejected `pool` coming back for a main agent, and the phone's contract does not even list `pool` for threads. ```mermaid sequenceDiagram participant P as Person participant D as Desktop participant G as Gateway P->>D: open channel settings D-->>P: This Mac / Boat / Any computer only Note over P,D: devbox and paired Macs never offered ``` ## The solution ```mermaid sequenceDiagram participant P as Person participant D as Desktop participant G as Gateway participant W as Worker "devbox" D->>G: devices.list G-->>D: online workers + SSH hosts P->>D: Computer ▸ devbox (threads) D->>G: channel.setPlacement(threads = "devbox") G->>G: is devbox served? (under the channel lock) alt served G-->>D: ok, saved in channels.sqlite3 v6 P->>D: new chat in the channel G->>W: run it on devbox else not served G-->>D: channel_place_unavailable end ``` - **Domain** (6ec9311): `ChannelExecution` holds any `Place`. The words `local`, `boat`, `pool` keep their meaning; any other word must name an SSH host or `peer:<key>`. The internal names `here`, `peer:any` and `boat:thread` are refused. The main agent may now use the pool. - **Store** (6ec9311): channels.sqlite3 goes to v6. `channels-any-place.sql` rebuilds the three tables whose placement columns had `CHECK`s and keeps every row. - **Service** (6ec9311, 2a1b166): create and setPlacement check a named computer against the places the gateway serves, under the channel's lock and only when it changes, so a channel already on a computer that is offline still loads and can move. - **Wire** (6ec9311): placement fields are 1-253 byte strings; new error code `channel_place_unavailable`. Generated Rust and TypeScript regenerated. - **Desktop** (6ec9311, 2a1b166): channel settings gain a Computer segment with a menu of online workers and SSH hosts (hosts named like a kind are left out). The new-channel flow offers the same; a refusal sends the person back to the placement step. Headings use `channelPlaceWords` (Local / Boat / Any computer / host name). - **Stress step `place`** (6ec9311, 8e6a5b1, 189569f): pairs a worker, picks it for a channel's threads from the settings dialog, starts a chat in the channel and checks its lease is on that worker; also checks an unknown peer is refused. ## How we checked it - **Stress:** `place` alone, 20/20 held on latest main. The full gate runs in CI. - **Library tests:** channel and place tests (268) pass, including a v1-v5 → v6 upgrade test that keeps rows and then stores `devbox`, and a service test where a channel names a served host and its new chats run there. The full `nessa-server` lib suite passed before the rebase; the 6 tests that need a non-root user fail on main too. - **Desktop:** typecheck and the workspace/client vitest suites pass (2,253 tests), with a settings test for a channel on `devbox`. - **Clippy:** `-D warnings` on Linux, and on Windows through the mingw cross-check. - **Review:** one independent review round; its findings (stress destructuring, SSH hosts named like a kind, a check-then-save race, wording) are fixed in 2a1b166. A second round found nothing actionable. ## Tradeoffs and follow-ups - **Moving the main agent still starts a new main conversation.** The plan wants it kept; that needs P4's changeable placement record, so it waits on P4. - **A typo becomes an SSH host name.** `Place::named` reads any plain word as a host, so `"devbx"` is refused as `channel_place_unavailable`, not as an unknown word. - **The phone must be re-vendored** to decode the new values (its contract lacks `pool` for threads already). That follows in nessa-ios once this merges. ## Rollout The channel store upgrades itself from v5 to v6 on first open, in one transaction. Rolling back means restoring a v5 `channels.sqlite3` from backup, since older builds refuse a newer schema. --- _Generated by [Claude Code](https://claude.ai/code/session_01JcBpmUavSQzUs5aJwmDfpv)_ --------- Co-authored-by: Claude <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.
Before:
After:
Closes #1300
Background
Slice P2 of the plan "Simplify where agents run". P1 (#1293) gave the gateway one
Placetype. The decision of which place a new chat gets was still spread over four spots:create_admittedelsewhereflag inthread_starthandoffs.rsplace_in_poolThe problem
Each spot answered part of the question with its own inputs.
Forks went through the person rules:
The
elsewhereflag dropped a named-place thread out of its channel.The solution
sequenceDiagram participant Caller as Person, agent tool or fork participant Service as ConversationService participant Decide as decide_place participant Env as Environments Caller->>Service: create (place name?, channel?, fork's source place?) Service->>Decide: asked name, channel's place, default device, Creation Decide-->>Service: one Place, or InvalidInput / EnvironmentNotConfigured Service->>Env: place(conversation, Place) Env->>Env: pool? pool_choice(pool now, cloud)place_decision.rshas two pure functions:decide_place(PlaceAsk { asked, channel, default_device, creation }), withCreationbeingPerson,ThreadorFork(Place):InvalidInputbefore the name is read, as before.pool_choice(PoolNow, cloud)gives the same answers as the oldplace_in_pool, case by case.RequestedConversation.fork: Option<Place>: a fork carries its source's place. It is no longer a name next to a flag. The request fingerprint folds that place in asremote_name(), so a fork's fingerprint is the same as before and a retry of a fork saved by the old build still replays.thread_startloses itselsewhereflag.docs/design/channels.mdand thecreate_threadtool description now say what happens.channel-workspaces.mdlists the new source.How we checked it
tests/conversation/place_decision.rscovers every combination of name, channel, default device and creation kind, including forks. It also covers the pool overflow table.a_fork_of_a_conversation_here_runs_here_whatever_the_default_device(mutation_commands.rs). I checked that it fails when forks are treated as a person's creation.here, and checks its channel and approval mode.cargo clippy -D warningspasses on Linux, and on Windows through the mingw cross-check.await: the scripted agent'screate_threadnameshere.channel: makes a thread from a channel chat and checks it is listed in that channel. On the old code that thread was in no channel. The step also forks the channel chat from its row and checks the fork is in the channel.awaits=1 channels=1: 6/6 held.Tradeoffs
make_room. At the conversation limit, such a request no longer evicts an idle chat first. No test pins this.Rollout
Nothing special. Stored data is unchanged, and fork fingerprints are unchanged.
Generated by Claude Code