Skip to content

fix: stop asking Context Service to create sandbox pools - #469

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
moonlight16:fix/stop-context-service-sandbox-pools
Oct 9, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
moonlight16:fix/stop-context-service-sandbox-pools

Conversation

@moonlight16

Copy link
Copy Markdown
Member

First of the smaller PRs split out of #455.

Moca's /workloads asked Context Service to create sandbox pools (/v1/sandbox-pools). We're moving that responsibility: Moca will own its workloads and sandboxes, and Context Service will only store context (rossoctl/context-service#46).

This PR removes Moca's use of the sandbox-pool API. Until Moca provisions workloads itself, the /workloads routes, and any /runs request that names a workloadId, answer 501 workloads_unavailable. Runs without a workload are unchanged.

This unblocks rossoctl/context-service#46. #358 stays open for the dynamic workload work.

🤖 Generated with Claude Code

Moca's /workloads asked Context Service to create sandbox pools (/v1/sandbox-pools). Moca will own its workloads and sandboxes, and Context Service will only store context (rossoctl/context-service#46).

Remove Moca's use of the sandbox-pool API. Until Moca provisions workloads itself, the /workloads routes, and any /runs request that names a workloadId, answer 501 workloads_unavailable. Runs without a workload are unchanged.

Split out of rossoctl#455.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

A clean removal. The Context Service client, the workload store and handlers, authenticateSubject, and their tests are gone. /workloads[/{id}] (any method) and any /runs that names a workloadId (sync and async) now answer 501 workloads_unavailable before touching a sandbox or the queue. A run that names a workload is refused, not silently run on the default pool. That's the right call, and the tests pin it on both paths. I merged the branch into current main (it's 22 commits behind, no conflicts) and grepped for leftovers. Nothing outside docs/specs still references CONTEXT_SERVICE_*, authenticateSubject, /v1/sandbox-pools, or the removed error codes, and /runs still strips a caller-supplied sandboxPoolSelector. Two non-blocking comments are inline, both on docs.

FYI, not for this PR: LeafEnvelope.sandboxPoolSelector in harness/src/run-leaf.ts can no longer be set by any external caller (/runs deletes it and nothing re-adds it). Leaving it in place for the follow-up that provisions workloads makes sense.

Author: moonlight16 (MEMBER — maintainer)
Areas reviewed: TypeScript (knative-server), tests, docs
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing

Comment thread docs/context-service.md
authorize one API caller relative to another.
A `/runs` request that names a `workloadId` gets the same `501` instead of running on the default
sandbox pool. Requests without a `workloadId` are unchanged. `CONTEXT_SERVICE_URL` and
`CONTEXT_SERVICE_TIMEOUT_MS` are no longer read.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Add an upgrade note for deployments that used the old routes. Workload records were written to Redis as sh:workload:<id> with no TTL (saveWorkload passed no EX). The Context Service pools behind them were created via POST /workloads, and with this PR Moca no longer has a way to release them: DELETE is now a 501. One or two sentences would cover it. Release any existing pools in Context Service directly (before or after upgrading), and the sh:workload:* keys can be deleted.

Comment thread docs/context-service.md
sandbox-pool configuration behave as before.
MOCA no longer asks Context Service to allocate sandbox pools. Context Service is moving to context
storage only (rossoctl/context-service#46), and MOCA will provision workloads itself
(rossoctl/moca#455).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: This line and the comment at packages/knative-server/src/server.ts:453 cite #455 as where Moca will provision workloads. #455 is a PR (the one this was split out of), and your description says #358 stays open for the dynamic workload work. A tracking issue will outlive a PR that may be split or closed, so consider pointing both at #358 (or a new issue).

@pdettori
pdettori merged commit 22d891e into rossoctl:main Oct 9, 2026
14 checks passed
pdettori added a commit to pdettori/moca that referenced this pull request Oct 9, 2026
…#473)

Resolve server.ts in main's favour for the workload lifecycle — every
/workloads route and any run naming a workloadId now answers 501
workloads_unavailable (rossoctl#455) — keeping this branch's error-code changes on
top. The spec follows: the /v1/runs 404 loses workload_not_found, the 501
gains workloads_unavailable, and the sandboxPoolSelector note drops the
workload-resolver clause. routes.ts workload summaries note the 501.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <dettori@us.ibm.com>
moonlight16 added a commit to rossoctl/context-service that referenced this pull request Oct 9, 2026
Context Service created Moca's execution environments through /v1/sandbox-pools: Sandboxes, sandbox profiles, and WarmPool claims. Moca now owns its sandboxes, and rossoctl/moca#469 removed its last call to this API.

Remove the sandbox-pool API, the Sandbox, profile and WarmPool code, contextctl sandbox-pool, CS_SANDBOX_IMAGE, and the matching RBAC. Context storage is unchanged.

Closes #46. Part of the work split out of rossoctl/moca#455.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>

Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>
pdettori pushed a commit that referenced this pull request Oct 9, 2026
Workloads created through the old /workloads routes are no longer released by Moca or Context Service. Document how to delete their Sandboxes, PVCs, and sh:workload:* Redis keys, and point the docs at #476 instead of #455.

Follow-up to #469.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants