Skip to content

Name each use of a Boat VM with the SDK's guards; one rest cause (C3) - #1339

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

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

Conversation

@Varuas37

Copy link
Copy Markdown
Contributor

Before: When a cloud VM was kept awake past its idle time, nothing said why. Nessa counted the VM's uses itself, with a count map and a lock map.

After: Every use of a VM has a name (opening, connection, background command). A refused rest logs who still holds the VM. The counting lives in workspace-sdk, the same code its own Machines uses.

Part of #1287. Depends on nessalabs/workspace-sdk#15: this pins the SDK to that branch's head, and the pin moves to the squash commit once it merges.

Background

Nessa runs each conversation's Boat VM itself (Workspaces). It rests a VM once nothing has used it for the idle time. Opening and resting must not overlap, or a rest could stop a VM that an opening is about to hand out.

The problem

Workspaces did this bookkeeping by hand: a count map, a lock map, and the rule that a count only goes up under the lock. Nothing checked that rule. When a VM stayed awake, a count of 1 said nothing about who held it. Nessa and the SDK also had two names for the same set of rest causes (WorkspaceRest and RestCause).

The solution

sequenceDiagram
    participant O as Opening
    participant U as Uses (SDK)
    participant R as Rest pass
    O->>U: take the VM's turn
    O->>U: hold "opening"
    O-->>U: serve adds "connection", background adds "background command"
    R->>U: take the VM's turn
    alt something still holds it
        R->>R: log the names, keep the VM awake
    else idle long enough
        R->>R: stop the VM, then say it rested
    end
Loading
  • Workspaces keeps one workspace_sdk::Uses<String>, keyed by conversation id. An opening holds "opening" under the turn. A served connection and a background command extend that use, so the VM cannot rest while either is alive.
  • A rest takes the same turn, refuses while anything holds the VM, and logs the names. Once the VM is stopped it calls turn.rested().
  • RestCause lives in the conversation domain and replaces WorkspaceRest. rest_cause(LeaseEndCause) maps a lease end to it in one place.

How we checked it

  • A new test follows one VM: the opening's use, a background command added to it, a failed serve that keeps no use, a rest refused while the command runs, and a rest that succeeds once it ends.
  • cargo clippy -p nessa-server --all-targets -D warnings and cargo fmt --check are clean.
  • nessa-server lib tests: 3,589 passed and 3 failed. The 3 failures (native_hooks a_failed_revert…, a_recorded_change_whose_marker…, and codex status_cleanup_removes_descendants…) also fail on main in the cloud sandbox, which runs as root. This PR does not touch that code.
  • pnpm test:e2e:stress --only vmBackground: 5/5 held.
  • Not run: a real Boat VM. That check is parked until the Mac is available.

Tradeoffs and follow-ups

  • The lease side (per-lease uses, removing unowned, the link count, the let_go polling loops and the count-based cache eviction) stays as it is. Those files are part of the lease protocol fingerprint, so changing them needs a new worker image. Saurav chose to wait for the next image, and the work is listed on Show why a cloud VM refused, not "environment unreachable" #1290.
  • Behaviour change: a successful rest now clears the idle start time. A wake that fails right after a rest therefore starts a new idle period, where before it was stopped on the next pass. The provider's own lifetime still backs this up.

Rollout

Nothing special. Merge workspace-sdk#15 first, then move this PR's SDK pin to its squash commit.


Generated by Claude Code

Workspaces drops its own count and lock maps for workspace_sdk::Uses,
keyed by conversation id. An opening takes the first use under the VM's
turn; a served connection and a background command extend it, so a rest
waits for the last one and logs who still holds the VM. RestCause moves
to the conversation domain and replaces WorkspaceRest.

Part of #1287. The lease-side half waits for the next worker image (#1290).

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: c90c34b4-c4d7-4793-be80-544472fad872
  • 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 21:38
@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-14T21:40:40.393344Z 7d3b9b1 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: 7d3b9b11ce

ℹ️ 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".

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

Copy link
Copy Markdown
Contributor Author

The only red job, "Windows server library tests (server-other)", failed on one test: external_events::tests::concurrent_duplicates_share_a_turn_and_changed_payload_conflicts in nessa-gateway, which hit its timeout (Elapsed(()) at tests/external_events/ingress.rs:452). 1,031 other tests in that shard passed. This PR doesn't touch external events or the ingress path. Its diff covers named workspace uses, RestCause, and the SDK pin. Every other check is green, including Windows server-conversation, local-auth on all three platforms, and the stress check. I've re-run the failed job once. If it fails again, I'll look at that test's wait directly.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The re-run of "Windows server library tests (server-other)" failed again, on four different tests this time. All four are Elapsed timeouts in product::socket::tests::review_notice_audit (review_notice_durable_audit_failure_prevents_publication_and_preserves_records, …_retains_physical_write, …_preserves_typed_decisions, review_notice_shutdown_joins_physical_write_and_queued_selection). The first run's only failure was a different timeout, in external_events.

I don't think this PR causes these:

  • The PR's only change in nessa-gateway is the SDK pin in Cargo.toml. Neither product/ nor external_events/ uses workspace_sdk.
  • The shard runs about 1,200 s on both branches. Main's latest run took 1,349 s and passed.
  • Main's same shard failed at b29c91f on yet another timeout (vault_tests::passphrase_change_requires_the_live_owner…, job 132526248836).

My read is that a different wall-clock test times out on each run when this Windows shard is under load, and that it's inherited from main. The proper fix is to make those tests wait on the state they check instead of a fixed timeout. That's outside this PR, so I've left it out.


Generated by Claude Code

@Varuas37
Varuas37 merged commit 9267adf into main Nov 14, 2026
23 of 27 checks passed
@Varuas37
Varuas37 deleted the claude/project-thread-mrby4w branch November 14, 2026 23:34
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