Skip to content

fix(harness): honor the session sandbox tier in /v1/runs - #715

Merged
moonlight16 merged 2 commits into
rossoctl:mainfrom
moonlight16:fix/runs-sandbox-tier
Nov 11, 2026
Merged

moonlight16 merged 2 commits into
rossoctl:mainfrom
moonlight16:fix/runs-sandbox-tier

Conversation

@moonlight16

@moonlight16 moonlight16 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

POST /v1/runs ignored the session's sandbox tier: knative-server puts sandboxTier in the
config it hands runLeaf, but the prompt, solve and verdict leaves never passed it to
selectPoolSandbox, so every run used the default tier while /v1/turn honored it. This passes
config.sandboxTier as the selection tier in all three leaves. A session with no tier is
unchanged. A microVM-tier run that names a workload now fails with a non-retryable WorkloadSandboxMisconfiguredError
instead of silently running in the container tier, since workload sandboxes are container-only.

Checklist

  • Commits are signed off (git commit -s).
  • make lint and the tests for the touched packages pass.
  • Docs: changed behavior, flags or environment variables are reflected in the relevant README or
    docs/ page, with the right maturity label (see docs/CONTRIBUTING-DOCS.md). (n/a: bug fix)
  • Docs: make check-links passes if any Markdown changed. (n/a)
  • A new spec or ADR is registered in docs/specs/README.md or docs/adrs/README.md. (n/a)

@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 11, 2026

@clawgenti clawgenti 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.

Clawgenti Code Review

All checks pass. Ready for human review.

Summary

The fix forwards config?.sandboxTier to selectPoolSandbox in the prompt, solve and verdict leaves. That matches how /v1/turn already passes input.config?.sandboxTier to acquireTurnSandbox, and select() already maps ''/absent to the deployment default (opts.tier || tiers.default), so a session with no tier behaves as before. The new tests cover the tier being passed and being absent for all three leaf kinds.

Author: moonlight16 (MEMBER — maintainer)
Areas reviewed: TypeScript (harness), Tests, Security
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (17/17)

Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).

@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

This forwards config.sandboxTier to selectPoolSandbox in the prompt, solve and verdict leaves, so POST /v1/runs honours the session tier the same way /v1/turn already does (run-turn.ts:914 passes input.config?.sandboxTier to acquireTurnSandbox). These are the only three selectPoolSandbox call sites in run-leaf. buildConfig sets sandboxTier only when the auth carries one, and selectPoolSandbox maps an absent tier to the deployment default (opts.tier || tiers.default), so sessions without a tier and deployments without SH_SANDBOX_TIERS are unchanged. Each leaf kind has tests for both the tier and no-tier cases. One suggestion inline: a microvm + workload run now gets a retryable 503 for a request that can never succeed.

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

Comment thread harness/src/run-leaf.ts
cap: promptTimings.cap,
ttlMs: promptTimings.ttlMs,
remoteSandbox: process.env.SH_REMOTE_SANDBOX === '1',
tier: config?.sandboxTier,

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 — With this change, a microVM-tier session whose /v1/runs names a workload ends in WorkloadSandboxUnavailableError. Workload sandboxes are container-only: workloads.ts:324 refuses tier: microvm, and the provisioner sets SANDBOX_TIER to the spec tier. So the tier filter (select-sandbox.ts:699) drops every workload record, and server.ts:1112 answers 503 workload_sandbox_unavailable with Retry-After, logging "no sandbox of this workload is attached". This combination can never be served, so the client is told to retry indefinitely and the log points the operator at the wrong cause (the PR body describes this as the intended outcome). Consider making it terminal: either throw WorkloadSandboxMisconfiguredError in selectPoolSandbox when workload is set and the effective tier is not one that workloads support (run-leaf already maps that error to a non-retryable error), or refuse up front in knative-server, which holds both the session tier and the workload. Please also add a test for the microvm + workload case: the body claims that behaviour, but none of the six new tests cover it. Not blocking, since the old behaviour (silently running a microVM-tier session in the container tier) was worse.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, good catch. Done in 14fd443: selectPoolSandbox now throws WorkloadSandboxMisconfiguredError when a workload is named with a tier workloads don't support, so microvm + workload fails fast as a non-retryable error instead of a 503 with Retry-After. Added tests for that case.

selectPoolSandbox now throws WorkloadSandboxMisconfiguredError when a
run names a workload with a session tier other than container, so the
client gets a non-retryable error instead of a 503 with Retry-After.

Signed-off-by: Jeremy Cohn <[email protected]>
@moonlight16
moonlight16 merged commit 6221b8e into rossoctl:main Nov 11, 2026
18 checks passed

@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.

Follow-up at 14fd443: this closes our earlier suggestion. A workload run whose effective tier isn't container now fails as WorkloadSandboxMisconfiguredError (terminal) before any record read or lease, instead of a retryable 503, and the new tests cover both the microvm and the explicit-container cases. Deployments without SH_SANDBOX_TIERS are unchanged. No new findings.

@moonlight16
moonlight16 deleted the fix/runs-sandbox-tier branch November 11, 2026 17:24
cwiklik added a commit to cwiklik/moca that referenced this pull request Nov 11, 2026
Upstream moved from c241116 to dd0ce71 (23 commits), mostly the OIDC
identity provider (rossoctl#701) and rossoctl#715's sandbox-tier fixes. Merged rather than
rebased: the branch has an open PR (rossoctl#717), and a rebase needs a force-push
that is not authorized.

Two files conflicted, both because upstream and this branch edited adjacent
lines:

- `packages/control-plane/src/handlers.ts`: this branch adds `getMetrics`
  between `healthz` and `getDiscovery`; upstream deleted the blank line
  there. Resolution keeps `getMetrics` and drops the blank line.
- `docs/reference/configuration.md`: upstream added the OIDC rows to the
  control-plane table, this branch rewrote the `LEAF_RESULT_TTL_SECONDS`
  cell, and prettier realigns every row of a table when one cell's width
  changes -- so the whole table conflicted over one real edit. Resolution
  keeps upstream's table with this branch's cell re-applied.

`deploy/vm/tests/setup-vm.test.sh` carries one unrelated fix, not a merge
artifact: upstream 294054a added two GNU-style `sed -i` calls with no
suffix, which abort the whole suite on BSD sed ("invalid command code f")
before it can validate anything. Both now use the `-i.bak` + `rm -f` idiom
the file's six other `sed -i` calls already use. Without it the VM deploy
suite -- one of the two this branch changed -- cannot run on macOS.

Verified on the merged tree: `make typecheck`, control-plane 1210,
knative-server 558, mocactl 1704, supervisor 239, work-queue 12, harness 784
(the one failure is the known pre-existing macOS `mv` issue in
`context-overlay.test.ts`), plus both deploy suites,
`setup-vm.test.sh` and `compose.test.sh`.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: cwiklik <[email protected]>
@pdettori pdettori added this to the v0.11.0 milestone Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants