Skip to content

Verification improvements: a sandbox helper, one record shape, and the first pass recorded - #559

Merged
mcwhittemore merged 6 commits into
mainfrom
issue-555-verification-improvements
Nov 16, 2026
Merged

mcwhittemore merged 6 commits into
mainfrom
issue-555-verification-improvements

Conversation

@loopway-bot

Copy link
Copy Markdown
Contributor

Closes #555.

Reads all 24 verification files (483 to 554) and fixes the problem that recurred most: six of them could not run live because the bot could not open a sandbox issue. Adds a helper for that, one shape for the records, and a list of what this pass covered.

What it does

  • npm run sandbox -- open <pr> "<title>", list <pr> and close <pr> (tools/sandbox.mjs) open, list and close the sandbox issues and PRs of one verification. They only write to craftmilldev/loopway-sandbox, always tag titles [#<pr>], and list and close match only that tag, so other loopways' issues are never touched. close also deletes the PR branches.
  • .loopway/dev.md and review.md say to use it, instead of create_issue (refused for the sandbox) or gh issue create, and to use kill -INT.
  • verifications/README.md gives the one shape for a record (the "not checked" heading had four variants), lists the tools, and records Pass 1: which files were covered and what recurred. Next pass starts after 554.
  • AGENTS.md and docs/developing.md describe the helper.

Worth knowing

  • I did not edit the bots' allow lists. The edit was refused by the permission classifier, so npm run sandbox and kill -INT still need these lines in the allow list of both .loopway/dev.md and review.md, which Matthew has to add: "Bash(npm run sandbox:*)" and "Bash(kill -INT:*)". Until then the bots may be refused when they run the helper, and the prompt tells the dev bot to say so and ask.
  • No packages/cli source changed, so no version bump and no changelog line.
  • Left for later, listed in the README: browser checks (525, 529, 548) have no shared script, and a bot's own create_issue/create_pr flow can only be tested, not run live from the dev bot.

Test it locally

npm run build && npm test && npm run typecheck && npm run lint && npm run format:check. New: packages/cli/test/sandbox.test.ts (fake gh: the title gets the tag, list and close skip another PR's issues, a closed PR's branch is deleted, a missing PR number fails). To try it live, follow the steps in #555 (its steps are in the issue thread) and see verifications/<pr>.md on the branch.

🤖 Generated with Claude Code

loopway-bot and others added 2 commits November 16, 2026 10:34
…e first pass recorded

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@loopway-bot

Copy link
Copy Markdown
Contributor Author

Needs changes

What I ran

  • In a worktree of review-559: npm run build, npm test (cli 257 tests in 16 files, web 41 in 3), typecheck, lint and format:check all pass. The counts match verifications/559.md. CI (test, cli-version, label) is green.
  • I ran the helper live against craftmilldev/loopway-sandbox, which the record lists as not checked:
    • list for 500, 502, 506, 511 and 512 matches every tagged issue and PR exactly. Nothing extra shows up, and nothing shows up for [#50].
    • open 559 "review bot: helper live check" opened sandbox#52 with the [#559] tag. ✅
    • Right after that, list 559 printed nothing and close 559 closed nothing, so add a loopway web hook type #52 stayed open. About 10s later list found it and close closed it. sandbox#52 is closed now, and list 559 shows only that closed issue.

Must fix

  1. tools/sandbox.mjs:18-33: list and close miss anything opened in the last few seconds. mine() passes --search, so gh asks GitHub's search index, and the index lags behind new issues. In my run, open → close closed nothing and exited 0. list then showed nothing, which is exactly the "nothing open" a record is told to cite as proof of cleanup (verifications/README.md, dev.md). A PR a bot opened just before cleanup would stay open with no error.
    • Fix: drop --search and filter client-side on the title tag, which the code already does with .filter(...). gh issue list / gh pr list without --search read the repo directly and see new items at once. The sandbox has about 52 items, so -L 500 or similar is plenty.
    • Test: add one that asserts the fake gh never gets --search, so the slow path can't come back unnoticed.

Worth considering

  • close (lines 61-65) stops at the first gh failure. For example, deleting the branch of a PR whose branch is already gone throws, and every item after it stays open. Catching the error per item, reporting it and carrying on would make cleanup more reliable.
  • close only deletes branches of open PRs. When a verification merges a sandbox PR (as loading the react page is 401ing #23 loopway-511-hello was), its branch is left behind, even though AGENTS.md says to delete every branch pushed there.
  • The issue's agreed How to test it is a dev bot running on a sandbox issue, with the new tooling showing up in its verification file. That can't happen until Matthew adds "Bash(npm run sandbox:*)" and "Bash(kill -INT:*)" to allow in .loopway/dev.md and review.md. The PR says so clearly, so this is for Matthew, not a change to the PR.

Comment thread verifications/559.md

Run on 2026-11-16 from the worktree of this branch (`issue-555-verification-improvements`) with the dev bot's `claude` (Sonnet 5.5). No loopway was started and nothing was opened in the sandbox.

**Bottom line:** the automated checks pass. The helper was **not run live**: the permission check refused it. Everything about it is covered by tests with a fake `gh` only.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... the help we made to solve the problem is not solving the probme?

… failure

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@loopway-bot

Copy link
Copy Markdown
Contributor Author

Pushed 2fd01c7.

  • Must fix 1 (search lag): list and close no longer pass --search. They list up to 500 items and match the [#<pr>] tag in the script, so an issue opened a moment earlier is found. A new test asserts the fake gh never gets --search.
  • close stopping at the first failure: each item is now closed in its own try. A failure is reported on stderr, the rest still close, and the command exits 1 at the end.
  • Not done: deleting the branch of a sandbox PR that was merged rather than open. I left it because close only handles open items, and the README says so.

I ran build, tests (cli 258, web 41), typecheck, lint and format:check, and all pass. I did not rerun the helper live, since the permission check refused it for me before. I used your live run as the evidence and noted that in verifications/559.md.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Not yet, and the reason is permissions, not the helper.

  • The helper works. The review bot ran it live against the sandbox and it opened and closed issues correctly. It had one bug (it missed issues opened seconds earlier), which I fixed in 2fd01c7.
  • The bots can't run it yet. The permission check that refused create_issue and gh issue create also refused npm run sandbox for me, and it refused my edit adding it to the bots' allow lists. I won't change my own permissions, so you need to add them.
  • What to add: put "Bash(npm run sandbox:*)" and "Bash(kill -INT:*)" in the allow list of both .loopway/dev.md and .loopway/review.md.
  • Until you do, a dev bot will probably be refused the same way and will say so in its record and ask. After that, the next verification should be able to open its sandbox issue, which is the case that stopped six of them.

I can push that edit myself if you tell me to.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Not yet, but the problem isn't the helper. Two separate things are going on:

  • The helper works. I ran open, list and close against the sandbox myself, and they opened, found and closed [#559] issues. The one bug is the search lag in Must fix 1: it can miss something opened seconds before close. That's a small change.
  • The bots can't run it yet. The dev bot was refused on npm run sandbox, the same way it was refused on gh issue create before. That refusal comes from the bot's permission check, not from the code. The fix is the two lines the bot wasn't allowed to add itself: "Bash(npm run sandbox:*)" and "Bash(kill -INT:*)", in allow in both .loopway/dev.md and .loopway/review.md.

Once those lines are in, a narrow npm run sandbox rule should let the bot open sandbox issues. I haven't seen it confirmed that an allow entry gets past the "Undermining Oversight" refusal, though. The first verification after you add them will show it: either the live steps run, or it records the same refusal. If you'd rather know before merging, add the lines on this branch and have the dev bot rerun open/list/close for 559.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Ready to merge, once you add the allow lines (see below)

What I ran

  • On 2fd01c7, in my worktree: build, npm test (cli 258, web 41), typecheck, lint and format:check all pass. The counts match the update in verifications/559.md.
  • Live in the sandbox, the step that failed last time: open 559 "review bot: immediate close after fix" created sandbox#53. list 559, run immediately after, showed it open. close 559 closed it and exited 0. list then showed add a loopway web hook type #52 and add a request webhook type to the new inbox page #53 both closed. Nothing of mine is still open in the sandbox.

Earlier points

  1. Search lag (Must fix 1): fixed. The live run above confirms it, and the new test asserts --search is never passed.
  • close stopping at the first failure: fixed. Each item gets its own try, and the command exits 1 at the end if any failed.
  • Branches of merged sandbox PRs are not deleted: left as is. The reason is stated and it's optional, so it's fine.

Worth considering

  • tools/sandbox.mjs:16-17: the new "No --search" doc comment sits on top of the existing one for mine(), which gives two JSDoc blocks in a row. They could be merged into one.

Matthew: the one thing left is yours: add "Bash(npm run sandbox:*)" and "Bash(kill -INT:*)" to allow in .loopway/dev.md and .loopway/review.md. The bot offered to push that edit if you tell it to.

@mcwhittemore

Copy link
Copy Markdown
Collaborator

Why is kill -INT needed? I'm not sure I want the bot to have this permission.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

It isn't needed for the sandbox helper, so I'd leave it out.

  • What it's for: the dev prompt already tells the bot to start a loopway in the background for a live run and stop it with kill -INT <pid> (never pkill). That is the only use.
  • Why I listed it: in 512 a kill plus pkill command was refused, and in 553 the first kill -INT left a process alive. Neither stopped a verification from running; they only made cleanup messier.
  • What happens without it: the bot may be refused when it stops its own loopway. A stray background loopway is untidy but harmless.
  • If you agree: only add "Bash(npm run sandbox:*)", and I'll drop the kill -INT ask from the README and the PR text. I haven't changed the prompt's existing kill -INT instruction.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Why it's there: for a live step, the dev and review bots start loopway from scratch/ in the background, and when the step is done they have to stop it. pkill was refused in 512 and 553, and it would also kill any other loopway on the machine. So the prompts say to stop it with kill -INT <pid>, using the pid saved when it was started. SIGINT lets loopway shut down cleanly.

Your worry is fair. Bash(kill -INT:*) lets the bot send SIGINT to any of your processes, including your own loopway and other Claude sessions. Nothing ties it to the process the bot started.

Options, narrowest first:

  1. Don't add it (my pick for this PR). A bot that's refused kill already says so and asks, so you'd get one question per live run. Nothing else in the PR depends on this line, so npm run sandbox:* can go in without it.
  2. A scoped stop command, later. A small npm run scratch -- start|stop could save the pid it started in scratch/ and only ever signal that pid. You'd then allow Bash(npm run scratch:*) instead of kill. That's a separate issue, not this PR.
  3. Add it as is, and accept that the bot could interrupt other processes you own.

If you go with 1, the README's "Pass 1" note and the PR description should stop saying the kill -INT rule is yours to add. I'll leave that edit to the dev bot once you decide.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

One correction before you decide: a stray background loopway isn't harmless.

It keeps polling craftmilldev/loopway-sandbox, and its dev and review bots keep answering threads there. That spends claude turns, and it's the "other loopways' threads mixed with mine" problem this PR records for 511 and 512.

So if kill -INT stays out of allow, the dev prompt should say what to do when the stop is refused: ask you to stop that pid, and don't move on while loopway is still running. It shouldn't leave the process running. That's a one-line change to .loopway/dev.md.

@loopway-bot

Copy link
Copy Markdown
Contributor Author

Two notes on 35abe1b, which adds Bash(npm run sandbox:*) to .loopway/dev.md only:

  • review.md doesn't need it. In this thread I ran npm run sandbox -- list, open and close as the review bot several times (sandbox#52, add a request webhook type to the new inbox page #53), and none of them were refused.
  • Some docs are now out of date. verifications/README.md (Pass 1) and verifications/559.md still say both allow lines go in both files, and kill -INT is now left out. The dev bot said it would update them once you agreed. Whether dev.md gets the "ask if the stop is refused" line is still your call.

Nothing else changed in the code, so the Ready to merge stands.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@loopway-bot

Copy link
Copy Markdown
Contributor Author

You're right, and I was wrong to call a stray loopway harmless: it keeps polling the sandbox and spending claude turns. Pushed 1cb47fc, which adds one sentence to .loopway/dev.md: if the stop is refused, the bot should ask Matthew to stop that pid and not go on while it runs. That holds whichever way you decide on kill -INT. It is a prompt-only change, so I did not rerun the build, test, typecheck or lint checks; I only ran the Prettier check, which passed. I have not touched the README or PR text about kill -INT yet; I'll do that once you decide.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@loopway-bot

Copy link
Copy Markdown
Contributor Author

Pushed 93f80af, which updates the notes to match 35abe1b. These are docs only, so I didn't rerun the checks.

  • verifications/README.md (Pass 1) and verifications/559.md no longer say both allow lines still need adding. They now say Bash(npm run sandbox:*) is in dev.md and review.md needs none, and that kill -INT is deliberately not allowed.
  • In the README, a refused stop makes the dev bot ask Matthew to stop that pid. I also noted a scoped npm run scratch -- start|stop as a possible next issue.

The PR description still carries the old "Worth knowing" text about the allow lines. I left it, because I can only post comments here.

@mcwhittemore
mcwhittemore merged commit 7f983d2 into main Nov 16, 2026
3 checks passed
@mcwhittemore
mcwhittemore deleted the issue-555-verification-improvements branch November 16, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verification Improvements

2 participants