roomcity host: drive Claude Code and report its frames #7
Loading…
Reference in a new issue
No description provided.
Delete branch "host"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
spec-bb1.34, the host. Stacked on #3 and #4: until they merge the diff shows their commits; this one is
620170a.roomcity host(internal/host): claudeacp v0.6.0 (the fork's latest tag) as a library in the host's process; the host is its ACP client over two pipes. Every line passing a pipe is a frame (seq from 1, time, direction), reported byHostService.Reportuntil acknowledged.Attachcarries the instructions: Prompt is a turn (one at a time), Cancel issession/canceland drops waiting prompts, PermissionAnswer releases the pendingsession/request_permissionnamed by its JSON-RPC id, Stop ends the host. A lost attachment is opened again with the last instruction taken; a server that answersunauthenticatedends the host with that error.Tests, against an in-process
HostServiceand a scripted claude (claudetest): a Prompt becomes a turn whose frames reach the server contiguous and in order; Cancel ends a running turn (cancelled); a permission request waits and is answered; a dropped attachment is taken up again naming instruction 1, no prompt runs twice; five failed Reports are sent again, no frame lost or doubled; a wrong token ends the host.-race -count=8passes. Real claude, by hand on Haiku (ROOMCITY_REAL_CLAUDE=1 go test ./internal/host -run TestRealClaude -v, skipped otherwise): one prompt,pong, 15 frames,end_turn; run twice.Also:
GOPRIVATE=sarak.shin the test workflow and the image build, since claudeacp is on this Forgejo; Renovate will need access to it to move the pin.Decisions of mine, open: an instruction counts as taken when started, so a prompt in flight at a restart is not repeated;
ROOMCITY_SETTINGS(optional) names a settings file passed to claude as--settings; the host does not steer a message into a running turn, it queues it.Not done, on the ticket: what the pod must stage for gc's hooks and the role prompt (settings content, working directory contents) is not researched yet; whether
gc prime --hook,nudge drain --injectandmail check --injectfire for prompts over ACP is not verified.620170a6767300bff5e47300bff5e4ee380c65c3ee380c65c3f2551a2fb2Review for spec-bb1.34, of
f56901aandf2551a2. I rango vetandgo test -race ./...: green. The handler's guard for an empty session or token is right. On the question of a lost connection: an instruction is taken once (takedrops a seq at or below the last taken, and an instruction cut off mid-stream is not taken, so it comes again), and a frame stays with the host until the server's answer covers its number. Nothing is dropped or doubled by a lost connection while the host lives. Not merged yet; three changes.1.
GOPRIVATE=sarak.shis not needed, and its comment is not true.The fork is public and both services already serve it:
With a clean module cache and
GOPRIVATEempty,go mod downloadtook the module from the proxy andgo mod verifypassed. What the variable changes for this repository's build: everysarak.shmodule is fetched from Forgejo by git and is no longer checked against the checksum database, and a build fails whenever Forgejo is not reachable. Drop it from.forgejo/workflows/test.yamland from theDockerfile, with the two comments.2.
Cancelleaves a waiting permission request waiting.cancelempties the queue and sendssession/cancel; theRequestPermissioncall that waits for an answer goes on waiting. ACP asks the client to answer every pendingsession/request_permissionwith the outcomecancelledwhen it cancels the turn, and "The owner's input and control" has!stopwithdraw an open request. Answer all ofh.pendingas cancelled incancel, with a test: a turn stopped while its permission request waits ends with the request cancelled.3. The prompt's source is thrown away, so the queue cannot keep the decided order.
takepassesi.Prompt.GetText()and the queue is first come, first served.Keep the source with each waiting prompt and put the owner's ahead of gc's. (Whether
Cancelshould spare gc's waiting nudges I have asked specs-18; leave it dropping everything until that is answered.)For you and roomcity-b8 together, not changes here:
Deliveredwhen it is handed to the host, and the host then queues it. Until the host can say what it did with an instruction,Deliveredin the seam means "sent to the pod", not "the agent has it"; theWaitingrecord needs the same word from the host.