Skip to content

Persistent computers: refuse to open one another run is using - #94

Merged
capy-ai[bot] merged 5 commits into
mainfrom
capy/persistent-refuse-running
Dec 5, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
capy/persistent-refuse-running

Conversation

@anamhira47

@anamhira47 anamhira47 commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the safety gap /verify dogfooding found (REV-6859): openPersistent(name) connected to a persistent computer that another run already had starting or running, and either run's close() then stopped the computer under the other.

What changes

  • TypeScript, Python, Go: openPersistent / open_persistent / OpenPersistent throw SESSION_BUSY (Go ErrSessionBusy) for a computer that is starting or running, before connecting and without stopping it. That covers both the computer's state at open, and a computer another run starts while this call waits for a stop to finish saving. A computer that is still stopping is waited for, as before. A start Revyl refuses with run_conflict no longer counts as attempted, so a timeout afterwards can't stop a computer another run started in the meantime. Before, the catch path could do that.
  • The message says how to fix the call: wait for that run to close it, use another name, or open a copy from a snapshot with fromSnapshot. It names the computer's ID in two existing calls: attach(id, { stopOnClose: false }) to work next to that run without stopping it (for a starting computer, "once listPersistent() shows it running", since attach() needs a running computer), and attach(id) then close() to stop a computer a killed script left running, keeping its disk.
  • Docs (api.md, the persistent-computers guide, the Python and Go READMEs) and the revyl-verify skill say so. CHANGELOG entries are under 0.9.3, Python 0.7.3 and Go v0.8.3, after Verify 0.9.2 / Python 0.7.2 / Go v0.8.2: print a failure as CODE: message after close() in finally #84's 0.9.2.
  • Also in docs and the revyl-verify skill (behaviour already in 0.9.1): a Mac's input limits ('meta' is Command and 'cmd' throws, no punctuation keys, no hover, typeFocused() needs { clear: false }) and the cloud browser's 20-second first-page timeout (SESSION_START_FAILED), with what to do about a cold dev server.

No new public option

There's no opt-in to connect anyway. Both real reasons to touch a running persistent computer, working next to the run that holds it and recovering one a killed script left running, are covered by attach(), which already ships in all three languages and was checked live against a persistent computer (below). One rule, "a persistent computer has one run at a time", is easier for an agent to get right than a flag.

Where the check lives

Revyl reports a persistent computer's state on GET /api/v1/computer-runs/persistent and GET /api/v1/computer-runs/{id} (starting, running, stopping, stopped; a run that is ending reads stopping). POST …/{id}/start on a computer that is already starting or running answers 200 with its status: it's idempotent and doesn't say who started it. So the SDK refuses on the state it reads. One window remains: two runs that start the same stopped computer within moments of each other both get 200 and both connect. Closing that needs the backend to refuse a start that it didn't perform (it already refuses pinned starts with computer_not_stopped); that's a backend follow-up, not in this PR.

Proof

  • Independent review of the diff (all three languages, docs claims against v0.9.1): two medium findings, both fixed in c5305ad (the run_conflict cleanup gap, and attach advice for a starting computer), plus three low-severity doc fixes.
  • npm run build, npm run typecheck, npm test (317 passed), check:package, check:links; Python ruff, format, mypy, pytest (780 passed); Go gofmt, vet, go test ./.... Existing tests unchanged; no tests added (org rule).
  • Live on Revyl staging, one persistent computer, deleted afterwards:
    1. Run A opened a new persistent computer and held it.
    2. Run B, a second process, called openPersistent with the same name and got SESSION_BUSY with the message above. The computer stayed running.
    3. Run B's attach(id, { stopOnClose: false }) ran exec(['sw_vers', '-productName']) (macOS), and its close() left the computer running.
    4. Run A was killed with SIGKILL. The computer stayed running, and openPersistent still refused it. attach(id) + close() then stopped it, and listPersistent() showed it stopped with a fresh savedAt.

Release

Behaviour change for anyone who relied on connecting to a running computer, so it ships as its own release after 0.9.2 (#84). Never tagged or merged here. docs.revyl.com is updated in the draft RevylAI/cognisim-monorepo#8750, which merges with the release.

Open in Capy


Note

Medium Risk
This is a breaking behavior change for anyone who relied on connecting to an already-running persistent computer; the new path is well-documented but agents and CI may need to use separate names or attach.

Overview
Persistent computers now enforce one run at a time. openPersistent / open_persistent / OpenPersistent no longer attaches to a computer that is starting or running in another run; they throw SESSION_BUSY and leave the machine alone, avoiding the case where either run's close() could stop the computer under the other. Waiting for a stopping save still works; failed starts with run_conflict no longer mark the open as "attempted," so error cleanup won't stop a computer another run started meanwhile. Errors point callers at attach (stopOnClose: false to work alongside the other run, or attach + close to recover a machine left running after a killed script), alternate names, or snapshot copies.

Docs, CHANGELOG (0.9.3 / Python 0.7.3 / Go 0.8.3), and the revyl-verify skill describe the new rule and drop the note that timeoutMs is skipped when reconnecting to an already-running persistent Mac.

Documentation-only: Mac input limits (meta vs cmd, no punctuation keys, no hover, typeFocused needs { clear: false }) and the cloud browser's 20-second first-page timeout are spelled out in computers.md, web.md, and the skill.

Reviewed by Cursor Bugbot for commit 34365b7. Bugbot is set up for automated code reviews on this repo. Configure here.

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

Open in Capy

anamhira47 and others added 2 commits December 5, 2026 00:17
openPersistent() connected to a persistent computer that another run had
starting or running, and either run's close() then stopped it under the
other. It now throws SESSION_BUSY and leaves the computer alone, naming
attach(id, { stopOnClose: false }) for working next to that run and
attach(id) + close() for a computer a killed script left running. Same in
Python and Go.

Docs and the revyl-verify skill also list a Mac's input limits and the
cloud browser's 20-second first-page timeout.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…h once running

A start Revyl refused with run_conflict no longer counts as attempted, so a
later timeout can't stop a computer another run started meanwhile. The
SESSION_BUSY message says to attach once a starting computer is running,
since attach() needs a running one. Docs: hover sentence placement, how to
type punctuation on a Mac, and the new SESSION_BUSY cause in errors.md.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@anamhira47
anamhira47 force-pushed the capy/persistent-refuse-running branch from db7300a to 55ec27b Compare December 5, 2026 00:21

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

View 2 other findings in Capy.

Open in Capy

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

…e-running

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

Open in Capy

…e-running

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

Open in Capy

@capy-ai
capy-ai Bot merged commit e886bc1 into main Dec 5, 2026
7 checks passed
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