Skip to content

feat(serve): run, read and cancel a mission over serve - #964

Merged
ajianaz merged 2 commits into
developfrom
feat/serve-mission
Nov 19, 2026
Merged

ajianaz merged 2 commits into
developfrom
feat/serve-mission

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Missions over serve: POST /missions {goal, max_steps?, max_minutes?, max_tokens?} starts a mission (202 {id, status: "running"}), GET /missions/{id} reads its status and fact/mission summary, POST /missions/{id}/cancel cancels it.

Why

Last operation of #947 (step 5 of #941). The route is /missions, not /sessions/{id}/mission as the issue sketched: a mission is its own session (its own pinned mission prompt and writer lock), so it cannot run on a live serve session. The verify command runs a process, so it stays the owner's configuration.

Changes

  • serve/missions.rs (new): the three routes. The mission runs the CLI's loop (mission::run_mission_outcome, from refactor(mission): return how a mission ended instead of printing and exiting #961) on a background thread over the serve workspace root. One mission at a time (409). Write approvals queue in the existing GET /approvals queue under the mission id (the registry is the server-session roster with the serve QueueApprover).
  • Owner configuration, never request fields: the verify command and its timeout ([mission] of the user config, read at serve start like tole mission), the budget ceilings (the tole mission tier or config max_*; a request may ask for less, a larger value is a 400), the workspace, allow list, sandbox and profile. A body with a verify key, or any key besides the four named, is a 400 and starts nothing. A --plan-mode server answers 409.
  • main.rs passes the settings into ServeConfig; serve.rs holds the table of missions and the route arms; mission.rs scopes a dead-code allowance to builds without serve.
  • docs/mobile-control.md rows and a CHANGELOG entry (Added, Behavior Change).

Testing

  • tests/serve_mission_e2e.rs against the real tole serve with a mock provider: runs to its budget and reports the summary (and the session file carries the register); bad bodies are 400, unknown missions 404, no session file left behind; a slow mission is running, a second is 409, cancel ends it as stopped, a second cancel is 409, no token is 401; a write waits in /approvals?session=<mission id>; the verify command comes from the user config (false fails three times, verify_failed) while a verify in the body is a 400 for every value.
  • Unit test mission_routes_refuse_owner_fields_and_keep_one_mission_at_a_time.
  • cargo fmt, clippy -D warnings in the default, --no-default-features and --no-default-features --features shell-tools profiles; full cargo test -p tole-cli passes in the default profile and with --no-default-features.

POST /missions starts a mission as its own session on a background thread through the CLI loop; GET /missions/{id} reads it; POST /missions/{id}/cancel cancels it. The verify command, budget ceilings, workspace, allow list and sandbox are owner configuration, never request fields.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit cc1e0dd into develop Nov 19, 2026
23 checks passed
@ajianaz
ajianaz deleted the feat/serve-mission branch November 20, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant