Skip to content

A quarantined env raises Quarantined, with drumsd's reason and next - #22

Open
ixchio wants to merge 1 commit into
Drums-Labs:mainfrom
ixchio:quarantined-error
Open

ixchio wants to merge 1 commit into
Drums-Labs:mainfrom
ixchio:quarantined-error

Conversation

@ixchio

@ixchio ixchio commented Nov 30, 2026

Copy link
Copy Markdown

What changed

Follow-up to Drums-Labs/drumsd#12, which asked the SDK for a dedicated error here.

Once an env is quarantined, drumsd refuses every reset, step, save and fork on it with 409 wrong_state, and since drumsd v0.2.1 that body also has reason (why it was quarantined) and next (what to do). The SDK turned it into a bare Conflict and dropped both. So the only way to tell "this env won't come back" apart from any other 409 was a GET, and the harness in that issue just kept resetting: 10,325 resets in 50 s.

Client.call now raises drums.Quarantined for a 409 with code: wrong_state and state: quarantined.

  • It's a subclass of Conflict, so existing except Conflict code still catches it.
  • .reason and .next come straight from the body. drumsd v0.2.0 sent only code and state; that's still raised as Quarantined, with both None.
  • The message gives the way out before the reason: env.release() then env.reset(), or env.close() and a new env. A reason can be up to 4000 characters and drums mcp cuts a tool error at 1000, so with the reason first an agent calling reset would never see what to do.

There's also a row in the README errors table and a CHANGELOG entry under Unreleased, and the Conflict, GateFailed and Env.reset docstrings now point at the new error.

Left out on purpose: reset() doesn't release and retry by itself. The issue mentions that as the other option, but it would quietly start a new episode, and everywhere else the SDK raises and leaves that call to the caller.

Not checked: whether the Drums Cloud gateway passes drumsd's 409 body through unchanged. NotQuiescent and CheckpointStale depend on the same thing, so I assumed it does.

How it was tested

  • python -m unittest discover -s tests on 3.9, 3.10, 3.11, 3.12 and 3.13: 166 tests, OK. Two are new:

    • test_client: reset on a quarantined env raises Quarantined with the body's reason and next and is sent once, and step, save and fork raise it too. A v0.2.0 body (no reason) is still Quarantined, and a 409 from an env that's down stays a plain Conflict.
    • test_mcp_server: the reset tool on a quarantined computer with a 4000-character reason still shows the way out within the 1000 characters a tool error keeps.

    Both fail on main, and putting the reason in front of the advice fails the MCP one.

  • python -m build and twine check --strict dist/* pass.

Checklist

  • Tests added or updated for the behaviour that changed, including the error path
  • CHANGELOG.md updated under the next version heading
  • Docstrings say what the method sends, returns and raises
  • No third-party runtime dependency added
  • No tokens, keys, private hostnames or account identifiers in code, tests, fixtures or docs
  • Commits are signed off (git commit -s, see CONTRIBUTING.md)

drumsd refuses every reset, step, save and fork on a quarantined env with
409 wrong_state, and since v0.2.1 the body also says why the env was
quarantined (reason) and what to do about it (next). The SDK raised a
bare Conflict and dropped both, so telling "this env won't come back"
apart from any other 409 took a GET, and a loop that didn't do one kept
resetting: the harness in drumsd issue 12 sent 10,325 resets in 50 s.

Quarantined is a Conflict, so except Conflict still catches it. Its
message gives the way out (release then reset, or close it and make a
new env) before the reason, because a reason can run to 4000 characters
and drums mcp cuts a tool error at 1000. drumsd v0.2.0 sent only code and
state; that is still raised as Quarantined, with reason and next None.

Signed-off-by: ixchio <202552852+ixchio@users.noreply.github.com>

This branch has not been deployed

No deployments
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