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

MGS3024: a hook names no agent host

A hook script (magus-command, magus-path, magus-observe or magus-checkpoint, in either its sh or Buzz form) ran without being told which agent host called it:

[MGS3024] this hook passed no --agent-name, so magus cannot tell which host it
answers: merge what `magus describe harness` prints into the host's hook configuration.

On a guard hook the call is denied. On the observe and checkpoint hooks nothing is recorded and the message goes to stderr.

Why

The glue picks the reply a host can parse from the host's name. Claude Code takes permissionDecision: "ask" and prompts; Codex marks the same reply a failed hook and runs the call. So a reply chosen for the wrong host can let a call through that should have been stopped.

magus does not work the host out from the event's shape or default to one host. The host says who it is, and the configuration magus describe harness prints for each host passes its name, the harness spell's own mgs_getName(), on every hook command: -- --agent-name claude-code after a Buzz script, --agent-name codex after an sh one. See Told, never guessed.

What to do

Run magus describe harness <host> and the merge command it prints, or add --agent-name <host> to the hook command by hand if you wrote the configuration yourself.

MGS3024guardhooksagentsharnessagent-name
Last updated (2df714e8)
Earlier changes on this page (4)

Full history ↗ · Blame source ↗

Glossary

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.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. Spell in full.

Buzz

The language magusfiles are written in (the .buzz engine). Buzz 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.

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.

Harness

The deterministic scaffolding around the work on a change, for a person or an agent: compiler errors, formatters, linters, checks, gates, leases and hooks, placed at points a person chose. Around an agent's loop, magus supplies one and keeps it outside. Harness 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.

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.