Repository navigation
feat: kontext dispatch gives a ready epic its own sandbox (core) - #55
Merged
Merged
Conversation
`kontext dispatch <epic>` checks that the project syncs through a server, the plan is signed, the epic is open in a ready wave, it has no sandbox yet and the cap is not reached (exit 2 with one line otherwise), reserves the epic under a state lock, makes a coordinator token for it and a sandbox that gets the token as a 0600 file. Anything that fails after the token stops the sandbox and revokes the token. `dispatch status` and `dispatch stop` follow it; `[dispatch]` in project.toml configures it; the state is machine-local in the config folder; the ledger gets a journal entry at the start and the end, and `kontext tree` says "in a sandbox since". Everything Boat-specific is behind the `Provider` trait; the tests use a fake boat and the local server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OmarAlex24
force-pushed
the
dispatch/core
branch
from
November 16, 2026 22:53
70f4853 to
84e72e6
Compare
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.
Bottom of the
kontext dispatchstack (4 PRs): the core, against a fake Boat.kontext dispatch <epic>gives an epic of a ready wave a sandbox of its own, with a coordinator token that reaches it only as a file.What changed and why
kontext dispatch <epic>(src/dispatch/mod.rs)agent:epic:<name>, valid for the time limit plus 2 hours. Its id is saved; the token itself is written to a 0600 file made withcreate_newin the dispatch folder, handed toboat new --file .kontext-dispatch-token=<file>, and removed as soon asboat newreturns (and on drop). It is never in argv,-e, stdout, stderr or a log.boat new:--name kontext-<project>-<epic>,--environment(if configured),--type,--ttl(time limit + 1 h),--setup-file, and-efor KONTEXT_SERVER, KONTEXT_PROJECT, KONTEXT_ACTOR=agent:epic:, KONTEXT_ROLE=coordinator and KONTEXT_EPIC. In this layer--setup-fileis wired in the adapter but dispatch passes no script yet (feat: the Boat adapter's start script and the coordinator's first turn #56 adds it).stuckwith the reason, sostatusshows it.fields.dispatch = start|end, the epic id, the service, the sandbox id and the outcome, fromagent:dispatcher.kontext treeshows "in a sandbox since " from it.kontext dispatch status [--json]: per epic its sandbox, since when, progress (tasks closed of total), state (starting, running, resumed, stuck, closed, stopped). Whether the watcher is alive comes with feat: the dispatch watcher closes, resumes and stops sandboxes by the ledger #57.kontext dispatch stop <epic>:boat stop(never delete) and revoke the token.src/dispatch/state.rs): machine-local, in<config>/dispatch/<project>/state.jsonunder a file lock.src/dispatch/provider.rs): one trait per service,Boatits only impl ($KONTEXT_BOATorboat, run withBOAT_NO_UPDATE=1and stdin from null).src/config.rs): an optional[dispatch]table in project.toml:max_sandboxes,hours,environment,provider,model,machine,repo_dir,kontext_version,service.tests/dispatch.rs,tests/fixtures/fake-boat.sh): a fakeboatthat logs every call, and a local server (server/dev.mjsthrough Miniflare).Departures from the brief
-evariables (not secret; the agent can read its epic from it).stoppedstate besides the five named: whatdispatch stopleaves.--ttlis set to the time limit + 1 h, since Boat's default (1 h) would end the sandbox long before 8 h; the token lives 1 h longer than that.stuckrather than removed, so the owner sees why.KONTEXT_BOAT(the binary) andKONTEXT_DISPATCH_POLL_MS(the wait between checks) exist for the tests.Test plan
cargo fmt --check,cargo clippy --all-targets -- -D warningsand the fullcargo testpassed at this commitboat); epic that already has a sandbox, cap reached (in the dispatch test). A closed epic's refusal is in the code but no test asserts itkxt1.in the fake's calls log, the state file or the command's output; the token file is gone afterboat newdispatch stopstops the sandbox and the token is revoked on the serverboat newthat fails after making a sandbox: the sandbox is stopped, the token revoked, the run leftstuck🤖 Generated with Claude Code