Repository navigation
fix: kontext dispatch review findings, and the docs for boat exec - #62
Merged
Merged
Conversation
…eaves a sandbox billing - The watcher starts at the reservation and finishes or ends a starting run whose dispatch died (a per-epic lock says so); a sandbox made by a killed `new` is found by its name; the local secret files are swept and removed on SIGINT/SIGTERM. - Each run has an id: a dispatch writes only while its run is unchanged and live, so a stop or a close during the setup wait holds. - A run not cleaned up holds its epic and its cap slot, the watcher stays and retries with a backoff, and a clean-up lease keeps two from cleaning up the same run. - A time limit on a stale ledger is `overdue`, not stuck, until a fresh pull; every boat call has a time limit and runs outside the state lock; one broken run no longer stops the others. - Stuck questions never merge; `--json` prints why a dispatch failed; the tests' World::drop kills only its own watcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ner's credential DESIGN §12.5, the README, kontext-orchestrate and kontext-pm (with their hashes) and the dispatch help: no agent connected in Boat, the credential set once with `claude setup-token`, every permission inside the sandbox and the owner's GitHub login, the repo cloned by the start script, the overdue state, leases and retries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ode does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 tasks done
OmarAlex24
marked this pull request as ready for review
November 17, 2026 14:30
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.
Stacked on #61 (
dispatch/boat-exec). It fixes the review findings on the dispatch stack that #61 does not already fix, and updates the docs for theboat execflow. Each fix has a test that fails on #61's head (1e089c6) and passes here.What changes
A dispatch killed at any step leaves nothing running unwatched and no secret on disk (findings 2, 3, 7)
dispatchstarts the watcher right after the reservation, not at the end. It holds a per-epic lock (dispatching-<epic>.lock) while it works.startingrun's lock is free, the watcher takes it over:newthat was killed midway is found by its name (boat list --filter rp --json).tmp/, mode 0600, named with the pid (src/dispatch/guard.rs).dispatch,stopor watcher sweeps the files of dead pids.startinguntil the turn's pid is saved withrunning. The runner refuses to start a turn twice (exit 90), and whoever started the second one adopts the first process, so a kill between detach and save never runs two coordinators.A stop, or a close in the ledger, during the setup wait holds (finding 4)
dispatchgoes throughupdate_own, which writes only while the run still has that id and is live.dispatchcleans up what it made and stops with "epic X was {state} while dispatch was starting it".A run that was not cleaned up keeps its epic, its cap slot and the watcher (findings 5, 6)
billing()) blocks a redispatch of its epic and counts towardmax_sandboxes. The refusal sayskontext dispatch stop Xtries again.cleaning_until, 6 min) keepsstopand the watcher from cleaning up the same run at once.A deadline on a stale ledger does not mark the epic stuck (finding 9)
overdue. Its sandbox is still ended, because it bills.boatcalls have time limits, and runs are independent (finding 10)boatcall is killed past its limit:new15 min,stop5 min, the rest 2 min (KONTEXT_BOAT_TIMEOUT_MSin the tests).boatcall runs under the state lock anymore. The watcher claims the run under the lock, cleans up outside it, then merges what it did.pm_pending,end_pending).Stuck questions stay separate (finding 12)
no_merge.Small ones (finding 13)
--json, a failed dispatch prints{"error", "run"}on stdout, redacted.World::dropnow kills a pid only when it is still this test's watcher: it checks the lock and the command line.Docs:
[dispatch]example (modelclaude-opus-5-5, provider claude only).claude setup-token→kontext dispatch credential setstep and a note on what the coordinator can do.kontext-orchestrateandkontext-pmare updated, with their new hashes intemplates/skill-versions.txt.dispatchhelp is updated.Findings and tests
turns/is gonestop_ends_the_turn_removes_the_credential_stops_and_revokes(redispatch: a new turn 1 on the new sandbox)a_dispatch_killed_during_the_setup_wait_is_finished_by_the_watchera_dispatch_killed_during_boat_new_leaves_no_secret_and_its_sandbox_is_found,a_dispatch_killed_before_boat_new_is_ended_and_its_token_revokeda_stop_during_the_setup_wait_holds,an_epic_that_closes_during_the_setup_wait_stays_closeda_run_not_cleaned_up_holds_its_epic_and_the_watcher_staysan_empty_starting_run_is_ended_by_the_watcher,a_dispatch_killed_before_it_made_anything_frees_the_epica_restarted_watcher_picks_up_and_the_time_limit_marks_it_stucka_time_limit_on_a_stale_ledger_waits_for_a_fresh_pulla_hung_boat_call_blocks_nothing_and_times_out,one_broken_run_does_not_stop_the_others,a_stuck_sandbox_stops_even_when_the_pm_cannot_be_askeda_failed_install_stops_the_start_script_at_oncea_new_stuck_question_does_not_merge_into_an_old_onea_failed_dispatch_with_json_says_why_on_stdout; theWorld::dropchange is in the harness itself and has no test of its ownAlso added:
a_dispatch_killed_after_starting_the_turn_does_not_run_two_coordinators, a guard for a window this PR opens (the run now staysstartinguntil the turn's pid is saved), not a review finding; anda_closed_epic_is_refused, a gap the review listed. It already passed on #61.On how the tests were shown red: I ran this branch's
tests/dispatch.rsagainst #61's code. 15 of these tests failed there. Three of them (…before_it_made_anything…,…before_boat_new…,…after_starting_the_turn…) fail on #61 only because their pause hook (KONTEXT_DISPATCH_TEST_PAUSE) does not exist there; the findings they touch each have a hook-free red test too (3: thehang-newone; 7: the empty-run one).an_empty_starting_run_is_ended_by_the_watchercovers finding 7 without the hook, and it is red on #61.Departures and choices
id,pm_pending,end_pendingandcleaning_until, all serde-default, so an olderstate.jsonstill reads.overdueis a new run state, as above.boat list --filter rp --jsonis parsed loosely: any object with a matchingnameand anid, at any depth. I did not capture its real shape (I run noboatcommand beyond--help).Not verified without real Boat
boat exec --detach's pid stays Claude Code's throughbash -lc exec sh …, and that--killreachesclaude.exec's working directory and HOME./dev/shmis writable.git cloneandgh api user --jq .login/.idwith the environment's login.--killon a process that already exited.boat list --jsonand its--filtergroups.Test plan
cargo fmt --checkcargo clippy --all-targets -- -D warnings(fresh target dir)KONTEXT_REQUIRE_SERVER_TESTS=1 cargo test, full suite, fresh target dir: 525 passed, 0 failedtests/dispatch.rsagainst feat: the dispatch coordinator runs as Claude Code through boat exec #61's code: the new tests fail as described abovetemplates/skill-versions.txtmatches the changed skills (the install test)🤖 Generated with Claude Code