Repository navigation
Where a conversation runs is one Place type - #1293
Merged
Merged
Conversation
Add conversation::domain::Place (Here, Host, Peer, Pool, CloudVm). Names are read into it at the edges (placement file, a request's or tool call's environment, a channel's two columns) and printed only where written or sent. Environments::place, placement, of, runs_on, named and for_lease take and return Place; ChannelExecution holds two Places and refuses what a channel cannot hold yet. WorkspacePlacement, POOL and BOAT are gone. File and column contents and behaviour are unchanged. Refs #1289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcBpmUavSQzUs5aJwmDfpv
ChannelExecution keeps a private ChannelPlace, so its words are matched exhaustively and a refused place says why (ChannelPlaceRefusal). The run_command refusal matches on the Place it already has. Tests cover unparseable creation names and channel.create placement defaults; test imports moved to the module tops. Refs #1289 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.
|
Review round 2: the module and remote_name docs say only what holds; test files import each module once; placements doc names boat:thread. Refs #1289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcBpmUavSQzUs5aJwmDfpv
Review round 3 nits. Refs #1289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcBpmUavSQzUs5aJwmDfpv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcBpmUavSQzUs5aJwmDfpv
Varuas37
marked this pull request as ready for review
November 10, 2026 13:03
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:** - Forking a chat that runs on this computer could put the fork on the default device. - Forking a chat in a channel whose threads run on a cloud VM was refused. - When an agent made a thread and named where it runs, the thread left the channel and lost the parent's approval mode. **After:** - A fork runs exactly where its source runs and stays in its source's channel. - An agent's thread that names a place stays in its channel and keeps the parent's approval mode. - Everything else lands where it did before. Closes #1300 ## Background Slice P2 of the plan "Simplify where agents run". P1 (#1293) gave the gateway one `Place` type. The decision of *which* place a new chat gets was still spread over four spots: - the person/agent/channel/default-device rules inside `create_admitted` - the `elsewhere` flag in `thread_start` - the fork code in `handoffs.rs` - the pool-or-cloud overflow in `place_in_pool` ## The problem Each spot answered part of the question with its own inputs. Forks went through the person rules: - A here fork named no place, so it fell to the default device. - A fork of a remote channel chat named both a place and a channel, which a person may not do. The `elsewhere` flag dropped a named-place thread out of its channel. ## The solution ```mermaid 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.rs`** has two pure functions: - `decide_place(PlaceAsk { asked, channel, default_device, creation })`, with `Creation` being `Person`, `Thread` or `Fork(Place)`: - A fork gets its source's place. - A person's chat gets: the place it named outside a channel, else the channel's place, else the default device, else here. - An agent's thread gets: the place it named, else the channel's place, else here. - A person naming a place in a channel is refused `InvalidInput` before the name is read, as before. - `pool_choice(PoolNow, cloud)` gives the same answers as the old `place_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 as `remote_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_start`** loses its `elsewhere` flag. - **Docs:** `docs/design/channels.md` and the `create_thread` tool description now say what happens. `channel-workspaces.md` lists the new source. ## How we checked it - **Unit table:** `tests/conversation/place_decision.rs` covers every combination of name, channel, default device and creation kind, including forks. It also covers the pool overflow table. - **Service tests that fail on the old code:** - `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. - The owned-thread test in channels.rs now also makes a thread that names `here`, and checks its channel and approval mode. - **Rust suites:** - The conversation and composition library tests pass: 2,073 tests. - `cargo clippy -D warnings` passes on Linux, and on Windows through the mingw cross-check. - **Conversation stress (gate 19):** - `await`: the scripted agent's `create_thread` names `here`. - `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. - Ran locally with `awaits=1 channels=1`: 6/6 held. - **Review:** three independent review rounds. None found a correctness bug. Their findings on coverage, fingerprints and docs are fixed. ## Tradeoffs - **Refusal order:** a place name that is no place is now refused before agent selection and before `make_room`. At the conversation limit, such a request no longer evicts an idle chat first. No test pins this. - **Remote note:** whether an agent is told that its channel folder is on a remote gateway now follows the asked place, not the channel's place. That only differs for the new case: a thread naming another computer inside a channel. There is no service test with a remote host in a channel, because the fixtures have no remote environment. - **Stress fork check:** the stress step checks only the fork's channel. The fork's place is covered by the Rust test, because nothing runs on Boat in the stress run. ## Rollout Nothing special. Stored data is unchanged, and fork fingerprints are unchanged. --- _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 10, 2026
<!-- claude-projects-attribution: {"github_login":"Varuas37"} -->
_Requested by **Saurav** · [project
thread](https://claude.ai/code/project/chan_01UZaufydjNk2K88KGgoAfmr?thread=cmsg_01UZaufydjNk2K88KGgoAfmrXtYxpKtUk3x5AQcyy7Ex36)_
**Before:** nothing a person sees changes. For developers,
`nessa-protocol` is rebuilt whenever `nessa-sdk` changes, and gateway
code reads time in about 170 places, many of which a paused test cannot
move.
**After:** the protocol no longer depends on the SDK. Gateway time is
read in one place that paused tests control, and clippy refuses a direct
clock call in gateway code.
This is slice S3 of the core-split plan ("Smaller core: hot paths,
merges and CI time").
## Background
- `nessa-protocol` is what both ends of a gateway connection share.
`nessa-sdk` runs agents and keeps their records.
- The conversation view (`conversation.read`) has its shapes in the
protocol. A fold (`projection`) turns the SDK's committed records into
that view.
- `nessa-timer` already held the `Timer` port that some server parts are
handed.
## The problem
The protocol depended on the SDK in two ways:
- It borrowed about nine names and limits from the SDK: provider names,
lease limits and `SandboxProfile`.
- It held the projection, which reads SDK session records directly. So
the plan's estimate of "about 20 constants" was low: the projection was
the deep dependency.
Time: gateway code called `Instant::now`, `SystemTime::now`,
`tokio::time::sleep` and `std::thread::sleep` directly. Where a
`std::time::Instant` deadline sat next to a tokio sleep, a paused test
could not move that deadline, so tests waited in real time.
## The solution
```text
before: nessa-protocol ──▶ nessa-sdk
after: nessa-protocol ──▶ nessa-types ◀── nessa-sdk
nessa-projection ──▶ nessa-protocol, nessa-sdk
nessa-server, nessa-client-core ──▶ nessa-projection
```
1. **`nessa-types`** (new, no dependencies) holds the provider names,
lease limits and `SandboxProfile`. The SDK re-exports them under their
old paths, so SDK callers don't change.
2. **`nessa-projection`** (new) holds `projection.rs`, the `McpToolUis`
port and their tests, moved out of the protocol unchanged.
- The SDK-to-view conversions that were `From` impls in `view.rs` are
now `ViewOf` impls in this crate, because the orphan rule forbids `From`
between two foreign types.
- `MAX_VIEW_BYTES` moves to the protocol's `view.rs`, because the device
client reads it without the SDK.
- `ConversationAgentFeatures::unnegotiated()` spells out the SDK's
default capabilities, and a test checks that the two agree.
3. **`PACKAGE_DENYLISTS`** now refuses `nessa-sdk` anywhere in the
protocol's dependency graph, and refuses the SDK, the protocol and tokio
in `nessa-types`'s graph.
4. **`nessa_timer::clock`** is the one place gateway code reads time
when no `Timer` is handed in.
- `now`, `sleep` and `sleep_until` use tokio's clock, so a paused test
moves them.
- `os::now` and `os::sleep` use the system clock, for threads no runtime
drives.
- `wall_now` is for timestamps.
5. **The ban.** `clippy.toml` lists the direct calls. The workspace
lints table keeps `disallowed_methods` off, and `nessa-server` turns it
on outside its tests. `conversation::application::service` (which
declares `channels` and `owned_threads`) is allowed for now, because the
Place work (#1293) is rewriting it. The rule is written down in
CODING_STANDARDS.md.
6. **Lease protocol pin.** Several files that make up the lease
protocol's fingerprint changed: `lease.rs`, the three ACP bindings, the
lease value objects, and the env serve files that now read time through
the clock. `nessa-types` joins the fingerprint. The hash moves from
`239c696fd0e0b3f4` to `68607d55e45aebbc`. As in #1267, `release.rs` pins
the new hash and keeps the published worker image until one is rebuilt
for it. The frames and their meaning are unchanged.
## How we checked it
- `cargo test -p nessa-protocol -p nessa-projection -p nessa-types -p
nessa-timer` passes. These are the same projection tests as before, plus
one new test that the two capability defaults agree and one paused-clock
test.
- `cargo clippy --all-targets -D warnings` is clean on Linux. It is also
clean on a Windows cross-build of server, protocol, projection, types,
client-core, sdk and timer.
- A deliberate `Instant::now()` added to non-test gateway code fails
clippy, so the ban is live.
- The lease contract tests
(`shipping_worker_covers_the_compiled_lease_protocol`,
`every_source_of_the_lease_contract_names_the_protocol`) pass. The first
of these failed CI on the earlier head because of the fingerprint.
- These local checks also pass: `node
scripts/check-runtime-dependencies.mjs`, the architecture,
workspace-lints and CI-harness script tests, `pnpm protocol:check`,
`sdk:docs:check` and prettier.
- The full server suite, macOS, and the conversation stress and chaos
e2e run in CI here. The stress suite is unchanged, as the slice requires
for a refactor with no behavior change.
## Tradeoffs and follow-ups
- `service.rs`, `channels.rs` and `owned_threads.rs` keep their direct
time calls under an `allow` until the Place rewrite lands. Removing the
`allow` there is a one-line follow-up.
- `tokio::time::timeout` and `interval` already run on tokio's clock, so
they are not banned.
- Moving more tests onto paused time is per-test work. Many tests that
sleep wait on real file locks, SQLite or child processes, and a paused
clock would hang them. This PR makes paused time cover the code;
converting individual tests is a follow-up.
- Two new crates add two names to every `-p` list. S1, which is
reworking those CI lists, will see small conflicts in `local-auth.yml`.
- The lease hash change means a worker that dials in with the old image
takes this gateway's build, as for any lease-source change.
## Rollout
Nothing special. No data, settings or wire-format changes. A plain
revert undoes it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01JcBpmUWrrdWm47JpVje4FZ
---------
Co-authored-by: Claude <noreply@anthropic.com>
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.
Requested by Saurav · project thread
Before: Nothing a person sees. Inside the gateway, "where does this chat run" is a loose string that many places compare against constants.
After: Still nothing a person sees. Inside, it is one
Placevalue, read from text where it comes in and written back as text where it goes out.Closes #1289
Background
A chat can run in five places:
The part of the gateway that decides and remembers this is
Environments(conversation/application/placement.rs). It keeps a small placement file for each chat, and hands the agent the right environment when the chat opens.Channels also choose where their main agent runs and where their threads run. Each choice is stored as one word:
local,boatorpool.This is slice P1 of the plan "Simplify where agents run: audit and plan". The later slices all build on having one type:
EnvironmentsThe problem
The same fact had three spellings:
me@devbox,peer:<key>,peer:anyorboat:thread.POOLandBOAT: compared against those strings in eight places.WorkspacePlacement: mapped to the strings by hand when a chat was created.sequenceDiagram participant App as Desktop or agent participant Gateway as Gateway participant File as Placement file App->>Gateway: create a chat on "peer:any" Gateway->>Gateway: compare the text with POOL, BOAT, a host list Gateway->>File: write the text App->>Gateway: open the chat Gateway->>File: read the text Gateway->>Gateway: compare it with POOL and BOAT again, in every callerEach comparison was its own small decision. A channel's choice reached the same file through a second mapping.
The solution
sequenceDiagram participant App as Desktop or agent participant Gateway as Gateway participant File as Placement file App->>Gateway: create a chat on "peer:any" Gateway->>Gateway: read the text once as a Place (the pool) Gateway->>File: write the Place's name (same text as before) App->>Gateway: open the chat Gateway->>File: read the text once as a Place Gateway->>Gateway: every caller matches on the Place287e2dc1:Place(Here, Host, Peer, Pool, CloudVm) inconversation/domain.Place::namedreads a name andPlace::nameprints one.Environmentsand the placement store now take and returnPlace.ChannelExecutionholds two places, and parses and prints its own words.WorkspacePlacement,POOLandBOAT.536fb2f0,eff25909,458e615f: fixes from review.ChannelPlaceRefusal: an unknown word, a named computer, or the pool for the main agent.run_commandmatches on the place instead of comparing text.channel.createleaves out a placement.How we checked it
peer:anyandboat:threadPlace.nessa-serverlibrary suite ran, and 4,807 tests passed. The 6 that failed also fail onmainin this cloud box, because they check file permissions and the box runs as root.cargo fmt --all --check,cargo clippy -p nessa-server --all-targets -D warningsandscripts/check-architecture.mjsall pass.pool,channelandvmBackgroundsteps must still pass, and they run in CI's requiredconversation-stressjob. I did not run them locally.place.rsto the sources ofdocs/state/services/gateway/channel-workspaces.md. I left itssourceRevisionalone, because I did not review the whole page and the states it draws have not changed.Tradeoffs and follow-ups
Environments. The default-device checks inruntime_config.rsanddevices/application/setup.rsalso still sort names into kinds with their own code. Both predate this PR, and P2 and P3 take them on.environmenttext withPlace::name(). That is the edge where the text comes in.ChannelExecution::new: only tests use it today. It is the constructor P5 needs when channels can name a computer.Rollout
Nothing special. File and database contents are unchanged, so a plain merge or revert is enough.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JcBpmUavSQzUs5aJwmDfpv