Skip to content

Split the Boat account from each VM's spec; record why an opening failed - #1332

Merged
Varuas37 merged 2 commits into
mainfrom
claude/project-thread-mrby4w
Nov 14, 2026
Merged

Varuas37 merged 2 commits into
mainfrom
claude/project-thread-mrby4w

Conversation

@Varuas37

Copy link
Copy Markdown
Contributor

Before: When a cloud VM can't be opened, the gateway log is the only place that says why. The person, and anyone reading the audit, sees the same "environment unavailable" whether Boat isn't connected, the vault is locked, Boat failed, or the VM was refused.

After: The chat looks the same. Every opening the workspace service refuses is now recorded in the environment audit with one of the five things a person can do about it: not_connected, locked, provider_failed, refused or uncertain. Inside the gateway, the Boat account and the spec of each VM are now separate values.

Part of #1287 (C2). Showing the cause in the chat is #1290. That needs a lease-protocol change and a new worker image, and this PR leaves the protocol untouched.

Background

Workspaces (workspaces/application/workspaces.rs) opens a thread's Boat VM. It reads the saved Boat connection, either makes a VM or opens the one the thread's receipt names, and asks a Provider to create, connect, stop or roll it back. The provider is BoatProvider, which runs over the workspace SDK since #1304. Each consequential step is kept in the environment audit through RecoveryAudit.

The problem

  • One struct held two different facts. BoatConnection held both who Nessa is on Boat (the token) and what a VM is made from (image, environment, lifetime). For an existing VM, Workspaces patched a copy of the saved connection with the receipt's image and environment before every call. Nothing stopped a path from forgetting that patch and opening an old VM with the newly saved image.
  • Failed openings were neither sorted nor recorded. A failed opening became a warning in the log and environment_unavailable in the chat. It wasn't sorted into anything a person could act on, and it wasn't in the audit.
sequenceDiagram
    participant Chat
    participant W as Workspaces
    participant B as Boat
    Chat->>W: open the thread's VM
    W->>B: connect (saved connection, patched with the receipt's image)
    B-->>W: fails
    W-->>Chat: environment unavailable
    Note over W: why it failed is only in the gateway log
Loading

The solution

sequenceDiagram
    participant Chat
    participant W as Workspaces
    participant A as Environment audit
    participant B as Boat
    Chat->>W: open the thread's VM
    W->>B: connect (account, the VM's own spec from its receipt)
    B-->>W: fails
    W->>A: workspace_open_refused (thread, cause, kind)
    W-->>Chat: environment unavailable (unchanged until #1290)
Loading

All of this is in 0f19f04.

  • The account is split from the VM's spec. BoatAccount is just the token. VmSpec is one VM's image, environment and lifetime.
    • A new VM takes its spec from the saved connection (BoatConnection::new_vm), and the build's pinned image wins.
    • An existing VM takes its spec from its receipt (VmSpec::of_receipt).
    • Provider::create and connect take (account, spec). stop and remove take only the account.
  • Each failure maps to one cause. Failure::cause() sorts every failure into one of five causes:
    • not_connected: no connection, a bad token, a missing worker image, or an environment that can't run the agents.
    • locked: the vault is locked.
    • provider_failed: Boat or storage failed, so retrying can help.
    • refused: a settled admission refusal, or a VM that is missing or gone.
    • uncertain: a VM may or may not exist or be cleaned up, or a refusal whose receipt, audit or cleanup did not settle.
  • Each failed opening is recorded. Workspaces::open records RecoveryEvent::OpenRefused for every failed opening. Composition keeps it as workspace_open_refused in the durable environment audit. A failed record never changes the answer.
  • Docs. ADR 1160 gets the split and row B20. The channel-workspaces state page now covers this and C1's SDK move.

How we checked it

  • Library tests. cargo test -p nessa-server --lib -- workspaces:: passes 98 tests. The new ones cover:

    • every failure's cause, including each way an admission refusal can fail to settle;
    • each failed opening being recorded with its cause;
    • an existing VM opening with its receipt's image even when the saved and pinned images differ;
    • the real environment audit keeping the thread, cause and kind.
  • Stress. pnpm test:e2e:stress --only vmBackground held 5 of 5 in the cloud sandbox. The step now has Boat fail a rested VM's next opening, and checks two things:

    • the send is refused environment_unavailable;
    • the audit records provider_failed for that thread.
  • Lint. cargo clippy --no-deps -p nessa-server --all-targets -D warnings is clean, and fmt and prettier pass.

  • Review. There were two rounds of independent review. Round 1 found four issues, and all four were fixed:

    • a settled refusal was recorded as uncertain;
    • a missing VM was marked as retryable;
    • there was no test that the receipt's image wins;
    • there was no test of the real audit mapping.

    Round 2 found nothing.

  • Not run. No real Boat VM was used, and a Windows build was not run here. CI covers Windows.

Tradeoffs and follow-ups

  • The person still can't see the cause until Show why a cloud VM refused, not "environment unreachable" #1290 carries it through the lease protocol, which needs a new worker image.
  • InvalidInput always counts as not_connected. In an opening it is almost always a token Boat won't take. An invalid thread id or relay socket path would also land there. Those are programming or configuration errors, so I didn't split them into their own cause.
  • Not every refusal is recorded. Openings refused before Workspaces::open, by the channel lookup in conversation/infrastructure/workspaces.rs, still aren't recorded.

Rollout

Nothing special. The audit gets a new record kind, and no stored data changes. A plain revert undoes it.


Generated by Claude Code

C2 of #1287. A saved Boat connection is now a BoatAccount (the token) plus
the environment and image new VMs are made from. Each VM is driven by its
own VmSpec: from the connection when it is made (the build's pinned image
wins), from its receipt afterwards, so a changed connection never relocates
existing work. Stop and remove take only the account.

Failure::cause() sorts every failure into the five cases a person acts on
(not_connected, locked, provider_failed, refused, uncertain), and
Workspaces::open records each failed opening as OpenRefused, kept in the
environment audit as workspace_open_refused. A failed record never changes
the answer. The chat still shows environment_unavailable: carrying the
cause needs a lease-protocol change (#1290), which this leaves untouched.

Stress step vmBackground now has Boat fail a rested VM's next opening and
checks the send is refused and the audit carries provider_failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcBpmR4KqePxnFf8j2359i
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 791a9f92-b3bc-4948-9f01-b3ebd79081d7
  • 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

@Varuas37
Varuas37 marked this pull request as ready for review November 14, 2026 10:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T10:15:21.984828Z 0f19f04 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f19f0416f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The record of why an opening failed was written by the waiter, after the
allocation task: a waiter that left (the link's timeout) lost it. The
allocation task now writes it, panic included. A record the audit could
not save turns the failure into OpeningUnrecorded, which keeps the
opening's own failure, cause and code.

The stress step now sends through the composer: the message shows
"Error sending", the record is kept, and Send Again goes through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcBpmR4KqePxnFf8j2359i
@Varuas37
Varuas37 merged commit 826e07f into main Nov 14, 2026
14 checks passed
@Varuas37
Varuas37 deleted the claude/project-thread-mrby4w branch November 14, 2026 16:36
Varuas37 pushed a commit that referenced this pull request Nov 14, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcBpmTQfWyxdsN2yxEJM26
Varuas37 added a commit that referenced this pull request Nov 14, 2026
) (#1338)

**Before:** Nothing a person sees changes. The conversation service,
with its workspaces, MCP server use cases and timer, lived inside
`nessa-server`, so every change there rebuilt and retested the whole
gateway.

**After:** Nothing a person sees changes. That code is now its own
`nessa-conversation` crate. `nessa-server` depends on it and re-exports
it under the old paths (`crate::conversation`, `crate::workspaces`,
`crate::timer`, and so on), so the gateway's code reads as before. The
gateway log again carries the lines of the crates split out of it, which
the default log filter had been dropping since S4.

Closes #1312 (S5 of #1307). Part 1 was #1336.

## Background

#1307 moves the gateway toward a small core: domain crates that know
nothing about sockets or the desktop, with `nessa-server` doing only
composition. S5 takes the biggest piece, the conversation service, out
of `nessa-server`.

## The problem

`nessa-server` held about 200,000 lines. Most of them were the
conversation service and what it alone uses. Any edit to a socket
handler rebuilt all of it, and the server's library test binary ran all
3,600 tests together. Nothing kept the conversation code from reaching
into server-only modules either.

```mermaid
sequenceDiagram
    participant Edit as An edit anywhere in nessa-server
    participant Server as nessa-server (one crate)
    Edit->>Server: rebuild sockets, composition, conversation, workspaces, MCP
    Server->>Server: one library test binary runs every test
```

## The solution

`crates/nessa-conversation` now holds:

- the conversation service (`application`, `domain`, `infrastructure`),
which was `nessa-server/src/conversation`;
- `workspaces` (application, domain, infrastructure), the timer,
settings inheritance and the limit log;
- the MCP server use cases and the conversation tools, which were in
server `composition`;
- the conversation's halves of desktop runtime, device pairing and
attachments.

The move keeps behaviour as it was:

- Items that the server reaches went from `pub(crate)` to `pub`. Nothing
else in their code changed.
- Test hooks that server tests use are behind `#[cfg(any(test, feature =
"test-support"))]`. The crate's `test-support` feature turns on the
matching features of its dependencies. Private test helpers stay
`cfg(test)`.
- Tests moved with their code. Tests that drive the server's sockets or
composition stayed in `nessa-server` and use small fixtures the crate
exports (`owner_phone_test_support`, `service_with_command_hosts`).
- Two tests that spanned both sides were split at the line. For example,
the SSH login handoff test now checks the crate's lease in the crate and
the server's log line in the server.
- The lease protocol fingerprint covers the bytes of its listed source
files, so it is re-pinned with a history comment, as in S3 and S4. The
image id and the frames do not change.

```mermaid
sequenceDiagram
    participant Edit as An edit to a socket handler
    participant Server as nessa-server (composition + product)
    participant Conv as nessa-conversation
    Edit->>Server: rebuild the server only
    Server->>Conv: uses the built crate as it is
    Note over Conv: its own test binary runs in the server-conversation CI partition
```

The default log filter now names every Nessa crate the gateway is built
from. It named only `nessa_server`, `nessa_sdk` and
`nessa_gateway_endpoint`, and a filter of named targets drops every
target it does not name, errors included. So this split would have
silenced the conversation service. The S4 feature crates already on main
(attachments, peer gateways, device pairing, env serve, agent install,
backup) have been silent since S4. They are named now too. A test reads
this crate's manifest and fails if a Nessa dependency has no directive.
Other Nessa libraries stay off, as before.

CI and scripts follow the crate:

- `-p nessa-conversation` was added to the local-auth workflow,
`package.json`, and the CI plan's Rust package list.
- `cargo-test-parallel.mjs` runs the crate's test binary in the
`server-conversation` partition.
- The CI plan's workspace graph treats a crate whose sources point at
`../<other>/src` as depending on it.
- The architecture check and dependency graphs know the new crate.
Client core may not depend on it.
- Docs, state pages and stress scripts point at the new paths.

## How we checked it

- **Tests:**
  - `nessa-conversation` passed 1,882.
- `nessa-server` lib passed 1,712 of 1,715, and its integration suites
passed. The 3 failures are a Codex status-cleanup test and two
native-hook tests. They fail on main in this sandbox too, because it
runs as root.
- **Lint:** clippy with `-D warnings` is clean for both crates on Linux,
and on Windows through `x86_64-pc-windows-gnu`.
- **Scripts:** the architecture check passed, and so did the node script
tests (new tests cover the partition and the workspace graph).
- **Stress and chaos:** the conversation stress check held 73/73 and the
chaos check held 2/2. The `handoff` step was extended in #1336, which is
the S5 stress addition; this half adds no new behaviour to cover.
- **Logs:** the two new logging tests fail when
`nessa_conversation=info` is taken out of the filter, and pass with it.
- **Review:** three independent read-only review rounds. Every finding
is fixed in the first commit, for example test hooks that were missing
under the feature, CI filters that still named the old module paths, and
state-doc paths split across YAML lines.
- **Rebase:** rebased onto #1332, which changed workspace files that
moved here. Its edits were reapplied to the moved files.

## Tradeoffs and follow-ups

- Many items are now `pub` instead of `pub(crate)`, because the server
is a separate crate. S6 can narrow what the gateway needs.
- Server tests that need crate test hooks build the crate with
`test-support`.
- **Next:** S6 (#1313) moves the gateway's socket and product code into
`nessa-gateway` and leaves `nessa-server` as composition only.

## Rollout

Nothing special. Nothing stored or sent over the wire changes, so a
plain merge or revert is enough. The gateway log gets the split crates'
lines back, at the levels they had before S4.

---
🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JcBpmTQfWyxdsN2yxEJM26

---------

Co-authored-by: Claude <noreply@anthropic.com>
Varuas37 added a commit that referenced this pull request Nov 18, 2026
<!-- claude-projects-attribution: {"github_login":"Varuas37"} -->
_Requested by **Saurav** · [project
thread](https://claude.ai/code/project/chan_01UZaufydjNk2K88KGgoAfmr?thread=cmsg_01UZaufydjNk2K88KGgoAfmrX5YyyUXBGeQoMRRr3igVbS)_

**Before:** Of the 11 changes merged to main in the last day, two fixes
had no check in CI. A sidebar row losing its hover fill under its
actions (#1337), or onboarding asking for the vault passphrase (#1340),
could come back unnoticed.

**After:** The conversation stress suite (run by every PR's CI) fails if
either comes back. 2 gaps closed, no issues opened.

## Background

The daily test-gap run reviews what merged to main in the last 26 hours.
For each fix it puts the bug back and checks that a test CI runs fails.
A fix only a local script checks counts as a gap.

## The problem

- **#1337 (row hover).** When the pointer moved from a sidebar row onto
its trailing action (a channel's settings), the row lost its highlight.
Only `shared-controls.mjs --only rows` checked this, and no CI job runs
that script.
- **#1340 (onboarding vault).** The setup window opened the vault's
unlock dialog on its own. The stress `onboarding` step already refused a
vault dialog, but it ran over an unlocked vault. There the old code drew
no dialog either, so the step passed with the bug put back.

## The solution

All in `verification/desktop/scripts/conversation-stress.mjs`:

1. **`channel` step.** Once two channels exist, it finds the channel row
that is not selected (its rest and hover fills differ). It points at the
row, then at its settings beside it, and requires the same hover fill
both times.
2. **`onboarding` step.** It locks the vault through its native session,
as after a restart. Then it opens the setup window, which already
refuses any vault dialog. It unlocks the vault again afterwards.

## How we checked it

| Entry | Bug | What holds it now |
| --- | --- | --- |
| #1353 | A VM creation whose answer was lost never finished | Existing:
2 allocation tests fail with it put back |
| #1351 | A voice call ended when its chat left the panes | Existing: 2
VoiceController V16 tests fail with it put back |
| #1337 | Row hover dropped under its trailing actions | **New**
channel-step check: fails with the CSS put back (`rgba(0, 0, 0, 0), not
oklab(0.985 0 0 / 0.05)`), holds on main |
| #1340 | Onboarding asked for the passphrase | **New** locked vault in
the onboarding step: fails with the fix put back ("the setup window
opened a vault dialog on its own"), holds on main |
| #1350 #1346 #1339 #1332 | Features, copy, and SDK guard naming | Not
fixes |
| #1341 #1338 #1336 #1334 | Crate moves and refactors | Not fixes |

- Stress `--only onboarding,passphrase,channel,stop` in Chromium held
9/9 on this branch. `verification/desktop/scripts/lib/*.test.mjs` passed
698 tests. eslint and prettier are clean.
- Not run: WebKit (it cannot be downloaded in the cloud sandbox).

## Tradeoffs and follow-ups

- The hover check needs an unselected channel row. In the `stop` step
only one channel exists, and it is selected, so the check runs in the
`channel` step.
- The onboarding step briefly locks the shared vault. It unlocks it
again in a `finally`, so later steps see it unlocked.

## Rollout

Nothing special. Test-only change.

---
_Generated by [Claude
Code](https://claude.ai/code/session_018rccRX3nxAcKBWu6gcEXWB)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants