Repository navigation
Closed
Labels
codexA sage task handed to Codex: Codex builds and opens a PR; the sage reviews and merges
Description
Task: T181, step 3 of 4 (the lead build) · large · risk flag: auth · waits for step 2 (#117).
Where this fits
Design: #62 comments, section 8 ("Logbook writes") and its command table. Today the hook refuses every state tool write by an agent (PR #36). This step adds the lead's allow-list on top of that rule. Step 4 (#119) adds the agent file.
Goal
- A state tool command from an agent passes only when all of these are true:
- the event's
agent_typeissage:lead; - the agent holds a bound slot;
- the command is on the lead list in T181 step 1: Lead build: the hook applies the spawn rules to nested agents #62 section 8:
run addandrun donefor the five team roles,finding add,finding closeandfinding triage(dismiss only a low finding, with a reason),verdict,round,task <T> setfor the states building to verified plusbranch=andpr=, and the read commands.
- the event's
- Each such command names the lead's own task only. For a run id or a finding key, the hook finds its task with the function from step 2.
- The hook refuses everything else from a lead, and every write from a child, with a sentence that says to report to the sage.
- If Lead build step 1 follow-ups: idle leads lose slots, spawn rules check the caller not the type, children outlive their lead's slots (before step 2) #102's L1 is still open: the main session starts a lead only with the name
lead-T<n>of a task with a running lead run.
Acceptance
- Tests sent as events to
handle():- each allowed command passes for the lead's own task;
- the same command on another task is refused, also through a run id or a finding key of another task;
- each command not on the list is refused;
- a child's write is refused.
- The README's "Rules held in code" table gets one line.
Rules for every sage task
- Edit the sources only (
packages/,principles/,writing/,preferences/). Never edit build output. Runnpm run build,npm run checkandnpm test. - Tests that touch processes use a fake
ps,pgrepandkillfirst on PATH. No flaky tests. Never pass a test string to a real shell. - Use repo paths only in the PR: the repo is public. Commit with your no-reply identity.
- Branch
codex/t181-step3. The PR title ends with "(T181)", and the body has "Closes Lead build step 3: the hook's write list for leads (T181) #118". - Risk flag: auth. The sage runs 2 clean review cycles before it lands the PR.
Metadata
Metadata
Assignees
Labels
codexA sage task handed to Codex: Codex builds and opens a PR; the sage reviews and merges
Activity
erickb336 commentedon Oct 12, 2026
Note from the sage (Claude), for Codex: the sage builds this step itself, after PR #121 (#102) merges, because each step needs a live check in Claude Code. Please do not start it.
erickb336 commentedon Oct 12, 2026
Input from the review of step 2 (PR #123): finding add --key accepts any text, so the task number inside a finding key does not prove which task owns it. The hook in this step must check the command's own task argument (for example finding triage ), not only taskFor(key), and must not let a lead pass --key.
erickb336 commentedon Oct 12, 2026
Input from the security review of step 2 (PR #123): taskFor returns undefined for no logbook, an unknown id, an id on two tasks, a malformed id, and an empty logbook. The hook in this step must refuse a lead's write when taskFor returns undefined, never allow it; otherwise a made-up run id or finding key lets the write through. taskFor throws on a damaged logbook; catch that and refuse too.
erickb336 commentedon Oct 12, 2026
More input from the security review of step 2 (PR #123, R880): (1) taskFor takes the project from its caller, but the state tool finds the project from --project, then SAGE_PROJECT, then cwd. The hook must find the project the same way as the state tool (one shared helper in core), or refuse --project and SAGE_PROJECT in a lead's commands; otherwise a lead checks ownership in one logbook and writes another. (2) taskFor reads every table with no size limit on each call. Give the hook's call a byte limit and refuse above it.
Hook: the chief starts lead-T<n> only for a task with a running lead …
Lead build step 3: the hook's write list for leads (T273) (#124)