magus v0.4.3 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
3 min read

sleep-poll

A deny rule by default: it refuses a sleep before a status read, a call that only sleeps, or a wait on or retry into a full budget, and names what to run instead.

What it catches

A sleep before a status read, a call that only sleeps, or a wait on or retry into a full budget.

Why

Both are a wait whose loop is the caller's own next call. A sleep of ten seconds or more followed on the same line by a status read (kill -0, the process table, magus status or a job row, a pull request's checks, a CI run) looks once and leaves the next look to the next call. A call whose only work is sleeping, printing and reading a file once (sleep 300; echo tick, sleep 120 && tail -5 out.log, a for loop of sleeps and echoes) is a timer: its notice says only that time passed, where the work's own backgrounded call is announced with its result. Backgrounded it is refused at any length; in the foreground from ten seconds, since a foreground sleep past the tool timeout is moved to the background and becomes one. A shorter foreground sleep is a settle, and a line that also builds, tests or runs a script is work. A watch (--watch) is not a status read, and a loop is busy-wait's. A worker (a session whose lease is a child row or a subagent's) waits for the build budget only in the call the wait gates: magus status --wait piped into a magus call, which reserves the seat for it (a run, an affected or a graph build), or followed by && and the call. A magus status --wait that gates no magus call, --watch, a status read beside a sleep or inside a watcher, or a magus run after a sleep of ten seconds or more is refused. A worker that cannot wait commits, reports to its orchestrator that its check found no seat, and stops; the orchestrator waits once for every worker, and a spawn or magus job fork into a full budget tells it how full the budget is and which run has held it longest. A magus run or magus affected whose argv matches one this checkout's run log recorded refused with MGS3009 in the last 60 seconds is the same poll with no sleep at all: it is refused with magus status --wait | <the command> as the next line, which waits for a seat and then runs, or for a worker with the report-and-stop above. A line whose status --wait gates the run passes, and only run logs written inside the minute are opened. It compares argv exactly, so the same run with a flag added, removed or reordered is a different command. It cannot tell a one-off settle before a single check from the tenth look of a poll; the served watch answers both.

Default and override

By default this rule takes the decision deny. A workspace sets it by name, in its root magusfile, to deny, advise or off:

magus\guard.builtins({"sleep-poll": "advise"})

A loosening takes effect once it is committed; a tightening applies at once.

Seeing it

A verdict names its rule in brackets, which is how you got here:

deny [sleep-poll]: ...

A workspace that sets this rule to advise sees advise [sleep-poll]: ... instead.

magus describe rule sleep-poll prints the same entry at a terminal, and magus describe rules lists every rule this workspace enforces.

See also

guardrulessleep-polldeny
Last updated (61fd39a7)
Earlier changes on this page (1)

Full history ↗ · Blame source ↗

Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. Workspace in full.

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. Magusfile in full.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). Op in full.

Buzz

The language magusfiles are written in (the .buzz engine). Buzz in full.

Affected

The set of projects touched by a change; magus affected <target> runs a target only over them. Affected in full.

CI

An ordinary target you compose yourself with ctx.needs; magus does not hardcode its stages. It is the anchor magus affected ci keys off, and ci strips the rw charm. CI in full.

One-off

A single magus invocation that runs a target and exits, using a per-process pool; the opposite of the long-lived daemon or a service. One-off in full.

Agent

A model working through an agent host such as Claude Code, Codex, Cursor or OpenCode. magus treats an agent as one more caller of its CLI, MCP tools and console, held to the same checks as a person. Agent in full.

Tool

An action a model can call through its host: a name, a description, a typed input and a result. magus serves its tools over MCP, each a read of the workspace model or a run of the CLI it already has. Tool in full.

Session

An agent host's conversation, by the id the host delivers to its hooks. magus never mints one: a record with no session is unattributed, and the OS user it carries says whose account ran it. Session in full.

Job

The unit of delegated work, and one row of the job store: what an orchestrating agent handed out, with its goal, the checkpoint it was cut against, the paths it may write or must not touch, and the one check it runs. A job's holder is either a session, for work an orchestrator handed out, or the daemon, for its own maintenance. The store records; the agent guard is what reads those facts back when grading a write. Job in full.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate. Run in full.

Lease

The grant a holder takes on a job: the write and read paths that job declared, enforced in the checkout that took it with magus job exec. A job is the piece of work; a lease is permission over it. Lease in full.

Conventions

Placeholders

Angle brackets mark a value you replace with your own; never type the brackets:

magus run <target>
magus completion <shell>    # e.g. bash, zsh, fish

<target>, <path>, <shell>, <name> and the like are stand-ins, not literal text.