Skip to content

fix: route prompt runs to workload sandboxes - #340

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
moonlight16:fix/prompt-workload-routing
Sep 25, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
moonlight16:fix/prompt-workload-routing

Conversation

@moonlight16

Copy link
Copy Markdown
Member

Problem

POST /runs accepts a workloadId, but prompt runs currently use it only to verify that the workload exists. They discard the workload's sandbox selector and run in the default pool. As a result, a prompt cannot see the PVC mounted in the sandbox created for that workload.

Change

Resolve workloadId to its sandbox selector for prompt runs, matching the behavior of other run types. The common resolver covers both synchronous and queued execution; callers continue to provide only the workload ID, never a raw Kubernetes selector. The ADR and control-plane design now describe that contract.

Validation

  • 17 focused sync/async route tests pass
  • Knative server TypeScript check passes
  • Prettier and git diff --check pass

Closes #237

@moonlight16
moonlight16 force-pushed the fix/prompt-workload-routing branch from 906c839 to 569136a Compare September 24, 2026 19:32

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Clean, well-scoped fix. Removes the kind === 'prompt' special case in resolveRunWorkload() that made workload-addressed prompt runs ignore the workload's sandboxSelector (previously just warn-logged). Now prompt runs resolve the selector the same way every other leaf kind does, matching the PR title. ADR 0028 and the multi-user control-plane spec are updated to match, and tests cover both the sync (/runs) and async/queued (enqueue) paths.

Verification performed:

  • Confirmed both call sites of resolveRunWorkload (sync handleRunLeafParsed and async handleEnqueueLeafParsed) share the same function, so the fix applies uniformly — the new queued-path test is exercising a genuinely separate code path, not a duplicate.
  • Confirmed the client-supplied sandboxPoolSelector is still stripped at the HTTP boundary before dispatch, so this change doesn't weaken that invariant — the selector still only ever comes from the server-resolved WorkloadRecord.
  • The failing proto CI check is the known flaky vmpool timeout test, unrelated to this PR's TypeScript changes (confirmed via job log).

Author: moonlight16 (MEMBER — maintainer)
Areas reviewed: TypeScript (knative-server), Docs (ADR/spec), Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, signed-off: yes
CI status: all required checks passing; proto failing on a known unrelated flake (vmpool timeout)

@pdettori
pdettori merged commit 3057c5f into rossoctl:main Sep 25, 2026
12 of 13 checks passed
pdettori added a commit to pdettori/moca that referenced this pull request Nov 16, 2026
Sixteen ADRs still said Proposed although their decisions are in code
on main. Each status line now names the merged PRs that implemented it
and the date the core landed (format of ADR-0042), and notes what is
still owed where only part is built:

- 0028 (rossoctl#170, rossoctl#201, rossoctl#340; its KEDA transport removed by ADR-0041)
- 0029 (rossoctl#171), 0030 (rossoctl#214), 0031 (rossoctl#214, rossoctl#225)
- 0032 (rossoctl#249, rossoctl#350, as amended by MI1)
- 0035 (rossoctl#251; ADR-0048 adds lease mode beside it)
- 0036 (rossoctl#347), 0038 (rossoctl#458), 0039 (rossoctl#467), 0040 (rossoctl#481)
- 0043 (rossoctl#560, rossoctl#588, rossoctl#600, rossoctl#615), 0044 (rossoctl#563), 0045 (rossoctl#620)
- 0046 (phase 1: rossoctl#630, rossoctl#641, rossoctl#646; phase 2 owed)
- 0047 (M1 and M3: rossoctl#704, rossoctl#713, rossoctl#717, rossoctl#765; M2 owed)
- 0048 (rossoctl#706, rossoctl#763, rossoctl#802, rossoctl#808, rossoctl#814; off by default until the
  security review's lease sections are signed off)

The README index follows, and its 0033 row, which still said Proposed
after rossoctl#249 accepted the ADR, is corrected.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
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.

Decide whether a workload's sandbox pool selector should bound its kind:'prompt' leaves

2 participants