oliver-zehentleitner / maity

clean-up: round 2 CLI: plain-call hook docs drift (stale context entry, index, `$` wording) and invisible test inputs

Sign in to report

tsk-fn8qfktqvvkx Done Maity Coder Claude 003

From the clean-up audit tsk-hgnbapyw7hnh (round 2, CLI/runner changes since 80647565), read at 19ed029a. Paths are under cli/ unless they start with docs/. Behaviour stays the same; this card changes text and test spelling only.

1. Docs drift: an older context entry still says hooks are off for placements

  • Kind: docs drift.
  • Files: context/runner.md:2374-2375, entry 996b6f48 ("A placed Claude Code agent runs maity alone"). Its rejected alternative says "Rewriting the agent's command in a hook: hooks are switched off for placements (--setting-sources user)".
  • What is wrong: since #1752 the runner writes a PreToolUse hook into every sandboxed Claude Code session's --settings file (src/maity/runner/adapters.py:341-355). It also sets disableAllHooks: false. The new entry 63492c65 (context/runner.md:2377 ff.) records this. The old reason is now false, and a reader of 996b6f48 alone learns the opposite.
  • Proposal: reword the alternative. Rewriting the command is still rejected, because the harness owns the command, but hooks do run: the runner's own hook refuses (63492c65). Drop the --setting-sources reason.
  • Effort S. Risk none.

2. Docs drift: context/index.md does not list the plain-call hook entry

  • Kind: docs drift.
  • Files: context/index.md:64, the runner.md summary line. #1735 added the [git] entry to this line, but nothing from 63492c65 is there: not the hook that holds a maity line to one plain call, and not the Claude Code 2.1.295 gate on the sandbox.
  • Proposal: add one clause, for example "a placed Claude Code agent's maity line is one plain call, held to that by the runner's hook, and its sandbox only from Claude Code 2.1.295".
  • Effort S. Risk none.

3. Docs drift: "a $ is refused" does not match what the hook lets through

  • Kind: docs drift (text shown to agents and operators).
  • Files:
  • src/maity/runner/adapters.py:46-50 CLAUDE_MAITY_PROMPT ("... a heredoc or a $ is refused").
  • src/maity/runner/plaincall.py:6 (module docstring) and :30-34 REFUSED ("no newline and no $ ... put text in single quotes").
  • docs/runners.md:95 ("holds a heredoc, a newline or a $").
  • What is wrong: plain() (plaincall.py:42-77) accepts a $ inside single quotes. tests/test_plaincall.py:60 passes 'text with ; & | < > $ and (x)' on purpose. REFUSED itself tells the agent to use single quotes. The texts say every $ is refused, but only an unquoted or double-quoted one is. An agent told this may move every $` to a file when single quotes would do.
  • Proposal: say "a $ outside single quotes" in all three places. context/runner.md 63492c65 already describes the grammar correctly.
  • Effort S. Risk none. tests/test_adapters.py:22 and :801 refer to the constant, not its text.

4. Docs drift: docs/runners.md's list of sessions without a sandbox misses the version case

  • Kind: docs drift.
  • Files: docs/runners.md:95, the second open gap: "without the harness's sandbox (opencode, Claude Code off Linux or without bwrap and socat)".
  • What is wrong: since #1752 a Claude Code older than 2.1.295, or of an unknown version, also runs without the sandbox (src/maity/runner/capabilities.py:53-67). The same paragraph says so a few sentences later, but this list leaves it out.
  • Proposal: add "or older than 2.1.295" to the parenthesis.
  • Effort S. Risk none.

5. Tests: two test inputs depend on invisible characters

  • Kind: debt (a test you cannot read).
  • Files: tests/test_plaincall.py:51 "maity a b" in REFUSED, and :52, which starts with a byte order mark.
  • What is wrong: line 51 reads as a plain call that must be refused. It is refused only because the space is a non-ASCII one, and the file does not say so. Line 52's leading character is invisible too; only its comment hints at it. An editor or formatter that normalises whitespace turns case 51 into a failing test, and case 52 into a duplicate of "maity a ; x".
  • Proposal: write both as escapes ("maity a\u00a0b", "\ufeffmaity a ; x") and add a comment to each.
  • Effort S. Risk none.

Covered elsewhere

  • The sandbox version gate composed in five places, and its version table tested four times: a note on tsk-es92hh4pk6tc (item 20).
  • The chat id read in two ways in cli.py (_group_chat_of, _chat_suffix, cmd_chat): a note on tsk-sgaz43qazfzx.
  • Searched: runner, adapters, capabilities, cli.py, config, supervisor, plaincall, clean-up.

Effort: 5 x S.