Repository navigation
Conversation
`maka run` could only run one prompt in a new Session, and a run that stopped on a question or an approval was cancelled. A script or another agent had no way to answer it or follow up. Add `--session` to queue a prompt to an existing Session, `--no-wait` to return a JSON receipt once the prompt or answer is accepted, `--wait` to wait on the Session's current work, `--answer` to answer its pending question and `--stop` to stop its active Run. A wait that reaches a pending interaction now leaves the Run waiting and prints it as JSON. Ctrl+C withdraws only a message this invocation queued. Generated-by: Claude Code
This branch has not been deployed
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.
Supersedes #7149, which GitHub closed when
rust-previewwas deleted after the switch tomain. Rebased ontomain(73f2333); therun::tests, clippy and fmt below were rerun there.Summary
#7094 added
maka runfor a single prompt in a new Session. A script or another agent still can't follow up on that Session, and a run that stops on a question or an approval is cancelled withrun failed, so there's nothing left to answer. This is the follow-up I offered in #6366 (reply in thread).New options:
maka run --no-wait "<prompt>"{"status":"submitted","sessionId":…}maka run --session <id> "<prompt>"waitingJSONmaka run --session <id> --waitwaitingJSONmaka run --session <id> --answer '["Zeta"]'--no-waitreturns the receipt)waitingJSONmaka run --session <id> --stop{"status":"stopped","sessionId":…}A wait that reaches a pending interaction no longer cancels the Run. It prints
{"status":"waiting","sessionId":…,"interactions":[…]}and exits 0, which is the convention the 0.2maka runused. Questions include their text and options; other kinds only showkind.How it works, using only existing Host operations (
observe,queue,watch,work,pendingInteractions,interaction,respond,stop,workReadiness):agent.watch. Only the target differs: a message this invocation queued, a message or Run started elsewhere, or the Run that received an answer. Ctrl+C withdraws only a message this invocation queued; observing someone else's work just detaches.Endedis now matched to the target Run. The old loop took the firstEndedit saw, which is fine in a new Session but picks up an earlier Run's end when following up on an existing one.Endedthat may predate the subscription. Its failure row is found in the history tail byrun_id, so the diagnostic no longer depends on theEndedsequence.--waitpicks the last queue entry that isn't held, then the active Run, then the latest Run. It reads the queue beforeobserve, so a message admitted between the two reads shows up as the active Run instead of being skipped.--stopwas added because, without automatic cancellation, nothing in the CLI could abandon a waiting Run. It reusescancel_work's settle loop.Refs #6366
Review focus
waitingmatches 0.2, but a script has to parse stdout to tell an answer from a pending interaction. A distinct exit code is the alternative.--no-waitup front. I left--jsonout of this PR.--approve/--deny) aren't included: permission decisions need a scope and a granted set, so I'd rather handle them separately. Until then they're reported as{"kind":"permissions"}and handled in the workbench.Verification
cargo nextest run -p maka-cli --test integration -E 'test(/^run::/)': 8 passed.run_continues_a_session_started_without_waiting(new):--no-waitreceipt,--waitreturns the first answer, a second prompt on the same Session sees the first,--waiton the idle Session returns the latest answer, and the ephemeral Host releases the Root.run_reports_a_pending_question_and_continues_with_the_answer(new):AskUserQuestionis reported with its question and options,--answer '["Zeta"]'finishes the same Run, and answering again fails withsession has no pending question.run_reuses_service_host_and_stops_on_pending_interaction(updated): a sandbox permission request is reported aswaitinginstead of exit 1,--waitreturns the same report (the Run wasn't cancelled),--stoplets the service Host retire cleanly, and a second--stopfails withsession has no active run.run::tests pass unchanged, including the failure diagnostics after a model 400 and after a 429, which now come from therun_idlookup.cargo fmtandcargo clippy -p maka-cli --all-targets: no warnings in the changed files.just checkand the othermaka-clitest binaries.AI use
Select exactly one:
Tool(s) and scope: Claude Code drafted the implementation, tests and this description under my direction; I reviewed the design and the results. The commit carries
Generated-by: Claude Code.Checklist
Does this PR entail a change in behavior?