✨ feat(guard): Guard takes the owner's šŸ‘ on the agent's proposal (#515)

Merged
AT
10d ago
+165-15

Slice: #515

The shared Guard now takes the owner's šŸ‘ on the agent's proposal, as the work rules do, so one šŸ‘ settles both checks. Alok, 2026-11-20: "Yes, file it", then Decision: #515 as written on #515.

Why. On #512 and #513, Alok's šŸ‘ passed the work rules, but Guard counted only a Decision:, so he wrote one on each as well. The work rules have taken the šŸ‘ since P-20; Guard (P-62) never did, and no record gives a reason.

What changes, in scripts/guard.mjs:

  • approvedAt, for a slice added after its Work item's approval, also counts an owner's šŸ‘ on a Proposal: comment on the slice that:

    • is by an agent the default branch's settings name ("agent");
    • names the slice as the first #N on its first line;
    • got the šŸ‘ after the slice joined and after the proposal's last edit.

    This is how thumbsUp in src/work.ts reads it, and a test holds PROPOSAL to src/work.ts's.

  • The earliest answer across all places, a šŸ‘ included, sets when Guards: counts from.

  • agentsIn reads "agent", one login or a list. Settings with none count no šŸ‘, and a malformed one fails closed. The slice said a missing one fails closed; since onboard always writes it, counting no šŸ‘ instead keeps older settings judged as before, and still grants nothing.

  • A proposal GitHub no longer has (404) counts nothing. Any other failure to read reactions fails closed.

  • The refusal now says "nor reacted šŸ‘ to an agent's proposal for it".

The README (Guard and the reaction passage) and docs/decisions.md say so.

Checked:

  • pnpm check passes (output below).
  • New tests cover:
    • a šŸ‘ that passes;
    • a šŸ‘ from the agent;
    • one before the slice joined;
    • one before the proposal's last edit;
    • a proposal by someone else;
    • one naming another issue first;
    • no agents named;
    • no šŸ‘ at all;
    • the earliest of a šŸ‘ and a Decision:;
    • reactions that fail to read;
    • main's wiring with good, other and malformed agents.
pnpm check: exit 0
pnpm test:          tests 2117, pass 2117, fail 0
pnpm test:scripts:  tests 115,  pass 115,  fail 0
  guard.mjs  | line 100.00 | branch 96.69 | funcs 100.00

After merge: clients get it with the next release. This PR and #514 both append to docs/decisions.md, so the second to merge may need a rebase there.

Guards: scripts/guard.mjs, scripts/guard.test.mjs. scripts/guard.mjs is code-owned by Alok, so this waits for his review.

šŸ¤– Generated with Claude Code


Summary by cubic

Guard now counts the owner's šŸ‘ on an agent's proposal as approval for a slice added after its Work item, so one šŸ‘ settles both Guard and the work rules.

  • Reads the settings' "agent" (one login or a list); none named counts no šŸ‘, and anything malformed fails closed, as does an agent that is also an owner.
  • The šŸ‘ counts only on a proposal whose first #N is the slice, by a named agent, made after the slice joined and after the proposal's last edit, as src/work.ts reads it.
  • Reactions are read only on a proposal that could precede the earliest other answer, so a failed read refuses nothing an earlier Decision: settled; a deleted proposal counts nothing, other read failures fail closed.
  • The earliest of a šŸ‘ and a Decision: sets when Guards: counts from; the refusal offers a šŸ‘ only when the settings name an agent.
  • Documents the change in the README and docs/decisions.md; pnpm check and all tests pass.