Skip to content

ui-server: let an operator abandon a hosted compute job stuck as uncertain #3347

Open

Description

@schlessera

Context

Found while delivering #3108 (epic #3103). A hosted compute job left uncertain stays open, flagged stuck, until an operator accepts the outcome (ruling 8 under "Settled by #3108", docs/decisions/external-compute.md:624-626 on epic/3103-external-compute). brain compute abandon from a shell cannot reach it: core only lets the job's own caller abandon it (async abandon(caller, jobId) with its own(caller, jobId) check, packages/core/src/lib/compute/service.ts:506-509), and the CLI caller (cli, the OS user) does not match the hosted job's session caller. The host itself exposes no abandon path: the host-side abandonRun (packages/ui-server/src/brain/compute-host.ts:537-545) is used only when the job's admission record or job record is unreadable, and the stuck flag is set at packages/ui-server/src/brain/compute-host.ts:501-504.

The external compute ADR made reconcile and abandon CLI-only operator verbs with no MCP tool ("Operator verbs", docs/decisions/external-compute.md:571-572). The ruling below amends that rule for hosted jobs.

Source pointers are on epic/3103-external-compute at 18d859421; the hosted compute code reaches main with #3404.

Decision (maintainer, 2026-11-03)

A. Authenticated host route, owner only. A protected HTTP route (for example POST /api/compute/jobs/:id/abandon) that only the brain's authenticated owner may call. Each abandon is recorded in governance with the actor and a reason. The route is API-only at first; an Activity UI action is a later, separate issue. Agents and tools never reach it: no MCP tool, no agent-callable path.

This amends the external compute ADR's CLI-only operator-verb rule, so updating docs/decisions/external-compute.md is part of this work.

Rejected: B (operator CLI acting as the host) and C (auto-abandon host setting).

Scope

  • Add an owner-only authenticated host route that abandons a hosted compute job, reusing core's abandon semantics (only uncertain jobs; a job with a sandbox moves to releasing) and the host's ledger and Activity writes.
  • Record the abandon in governance with actor and reason.
  • Amend the "Operator verbs" section of docs/decisions/external-compute.md to name the hosted owner-only route as the exception to the CLI-only rule, and why agents never reach it.
  • Document the route in the contract docs.

Out of scope

  • An MCP tool or any agent-callable abandon.
  • Any UI (an Activity button needs its own issue and design).
  • Changing core abandon semantics for CLI callers, or reconcile.
  • An auto-abandon setting.

Acceptance criteria

  • The authenticated owner can abandon a hosted job that is uncertain through the new route; the action is recorded in governance with the actor and a reason.
  • A non-owner authenticated principal, an unauthenticated request, and an agent/tool path are all refused.
  • Abandoning settles the job's budget reservation as unknown, never 0, and closes its Activity run truthfully.
  • Jobs that are not uncertain, and jobs of other brains, refuse.
  • docs/decisions/external-compute.md "Operator verbs" records the amendment (owner-only host route for hosted jobs, API-only, never agent-reachable).
  • Keyless tests cover each case, with failing-first receipts.

Verification

Keyless host tests with the offline test provider and disposable compute state; focused tests through bun run test, typecheck and lint. A mutation that skips the uncertain check, skips the owner check, or settles at 0 fails a named test.

Contract impact

Additive: a new host route. CONTRACT: commit, contract docs updated and a changeset.

Triage 2026-11-03: folded the maintainer ruling (A: owner-only authenticated host route, API-only, never agent-reachable; ADR amendment in scope).

Activity

  1. added
    type: featA new capability or a change in user-visible behaviour.
    area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 2, 2026
  2. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Triage 2026-11-03: the external compute ADR makes abandon a CLI-only operator verb, so a hosted abandon path is a new operator surface. The body now asks which surface (A: owner-only host route, recommended; B: host-side CLI; C: auto-abandon setting) and who counts as operator. needs: decision. Attached to #3103.

  3. added
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    and removed
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 3, 2026
  4. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-03): A — an authenticated, owner-only host route (for example POST /api/compute/jobs/:id/abandon), recorded in governance with actor and reason. API-only first; an Activity UI action is a later, separate issue. Agents and tools never reach it. This amends the external compute ADR's CLI-only operator-verb rule, so the ADR update is part of the acceptance criteria. The body now specifies option A; B and C are rejected. Removed needs: decision; agent-ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: featA new capability or a change in user-visible behaviour.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions