Repository navigation
loopway 2.0 slice 3: Claude Code sessions per thread, through loopway's MCP - #502
Merged
Merged
Conversation
This was referenced Nov 11, 2026
Closed
|
This PR conflicts with its base branch. Rebase onto it, resolve the conflicts, and push. |
mcwhittemore
force-pushed
the
v2-slice-3-sessions
branch
from
November 11, 2026 01:46
343a8d2 to
212fed5
Compare
Collaborator
Author
| Rebased onto main (the TUI from #500 is in; its Session, Sent and log helpers were identical to mine, so I kept main's and added only markerOf). Checks pass (117 tests, typecheck, lint, format). verifications/502.md now shows the TUI thread view over a real session, log and (empty) Sent section. Still open: the saved bot token is rejected by GitHub, so the live comment steps need a refreshed token. If #504 merges first, I will move the session log and sent writes onto its state helpers. |
Collaborator
Author
|
It looks like something is wrong with the mcp server... |
Collaborator
Author
| Thanks for running it. The MCP server is working: your log shows the session calling mcp__loopway__comment and loopway answering. The failure is the bot token, which GitHub rejects with 401 (`could not comment: GitHub 401 on .../comments`). It is the same expired `github.token` in ~/.loopway/config.json that I hit; refreshing it should let the comment through. So that this does not hide inside the session, a refused comment is now also written to the thread log as `!! comment on failed: ...` (pushed, with a test, and noted in verifications/502.md). |
|
This PR conflicts with its base branch. Rebase onto it, resolve the conflicts, and push. |
… loopway's MCP Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mcwhittemore
force-pushed
the
v2-slice-3-sessions
branch
from
November 11, 2026 02:01
45b2f3f to
7e65cb3
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
| Rebased onto main with #504 (all my state now goes through `stateDir`, `threadLogPath` and the thread files under `~/.loopway/state//`; only config.json stays at the top). Reran the checks (121 tests, typecheck, lint, format) and steps 1 to 5 live in the sandbox with the refreshed bot token: `loopway-bot` answered 4, "Now times 3." resumed the same session and got 12, the bot own comments were not queued back, a bad model name failed the run with the error in the log, and the TUI showed the session, log and Sent section. The live run found a real bug: a brand-new issue queues nothing, so its thread never ran. A thread that has never run now gets a first run (and is told again after a failed first run). Details in verifications/502.md. Two notes: killing `claude` mid-run is covered by tests only, and sandbox issue 10 (yours, "What's 2+2?") was also answered by my loopway while it ran; I was not allowed to close it, so it is still open. |
Collaborator
Author
|
Does loopway · 0 threads
No threads yet.
waiting for the poller
↑/↓ move · enter open · esc clear filter · q quit |
Collaborator
Author
| It is polling. That line is the TUI placeholder for "the poller has not printed anything yet": the bottom line only changes when the poller reports an event (a new subject, an update) or an error, and a quiet repo reports nothing, so it stays on `waiting for the poller` (discovery every 2 minutes, known subjects every 30 seconds). In my sandbox run it showed that line until the first issue was found. It is slice 4 code, not this PR, so I have not changed it; I will pass it to the coordinator as a follow-up: show something like "polling, last checked 14:02" so a quiet repo does not look stuck. |
Collaborator
Author
|
I'm not seeing any updates. staring runner Matthews-MacBook-Pro:scratch mcwhittemore$ pwd
/Users/mcwhittemore/plumbline/garden/loopway/.claude/worktrees/agent-afa0630aa81fdf9e6/scratch
Matthews-MacBook-Pro:scratch mcwhittemore$ npm run cli
> loopway@2.0.0-alpha cli
> npm run start -w @loopway/cli --
> @loopway/cli@2.0.0-alpha start
> tsx src/index.tscreating issue Matthews-MacBook-Pro:loopway mcwhittemore$ gh issue create -R craftmilldev/loopway-sandbox --title "What's 2+3?" --body "Reply in one comment."
Creating issue in craftmilldev/loopway-sandbox
https://github.com/craftmilldev/loopway-sandbox/issues/13running runner loopway · 0 threads
No threads yet.
waiting for the poller
↑/↓ move · enter open · esc clear filter · q quit |
…T_CWD to the checkout root Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
| Found it, and it is my copy-paste block, not the poller. Your `ps` environment shows `INIT_CWD=.../agent-afa0630aa81fdf9e6` (the checkout root), not `scratch/`: under `npm run cli` npm sets INIT_CWD to the workspace root, so loopway read the checkout's own `.loopway/dev.md` (repos: craftmilldev/loopway) and never looked at the sandbox, which is why issue 13 showed nothing. Fix, pushed: run the built file from the scratch directory instead, `node ../packages/cli/dist/index.js` (after `npm run build`), in the README, docs/developing.md and the PR body. I checked it from another directory: it reads that directory's `.loopway/` and `~/.loopway/state/` follows it. To test now: stop the running loopway, then `cd scratch && node ../packages/cli/dist/index.js`. Issue 13 is older than that run's first start, so open a new sandbox issue after it starts. |
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #498. Slice 3 of #486.
Each open thread's queued updates now go to a Claude Code session that acts as
loopway-botand talks back through loopway's own MCP server.claude.ts,transcript.ts):claude -p --permission-mode auto --output-format stream-jsonwith the bot's prompt plus the updates; later batches use--resume. A usage limit holds every delivery until the reset. It lives inpackages/clirather than a new package, and is Claude Code only.modelandharness(defaultclaude). Sessions run in the directoryloopwayruns in (nocwdkey).sessions.ts): all queued updates in one run, oldest first;--max(default 3) caps runs. A delivered batch leaves the queue; an API error, usage limit or bad exit leaves it and the thread retries after 5 minutes. The env hasGH_TOKENand the git author and committer from thegithubblock of~/.loopway/config.json.mcp.ts): a local HTTP server withcomment(subject, body), one path per thread. Each comment is recorded on the thread (sent) and carries a hidden<!-- loopway:thread=<id> -->. A thread's own comment is not queued back to it, but is queued to every other thread holding the subject. A turn with no message logsturn ended without a message.session,sentand<state dir>/threads/<id>.logas written in 2.0 slice 3: Claude Code sessions per thread, talking through loopway's MCP #498.body, so the session can read it.How to test it locally
Needs
gh auth loginand a working bot token in~/.loopway/config.json({"github": {"token": "...", "name": "loopway-bot", "email": "loopwaybot@craftmill.dev"}}).run started,sent ... comment on ...andrun finished; a comment byloopway-botanswers 4, and it is not queued back to that thread.resumedand the answer is 12.model: nonesuchin.loopway/dev.mdand restartloopway: the log saysrun failed ..., the updates stay pending inloopway threads, and it retries after 5 minutes. Killingclaudemid-run does the same.(If state has moved by the time you read this, see the README's Credentials and state.) Close the sandbox issue when you are done.
Verification
verifications/502.md. Tests, typecheck, lint and format pass. Steps 1 to 5 ran live in the sandbox with the realclaudeand the refreshed bot token:loopway-botanswered 4, "Now times 3." resumed the same session and got 12, its own comments were not queued back, a bad model name failed the run with the error in the log, and the TUI showed the session, log and Sent section. Not done live: killingclaudemid-run (covered by tests). The live run found that a brand-new issue queued nothing, so its thread never ran; a thread that has never run now gets a first run.🤖 Generated with Claude Code