Repository navigation
fix(harness): honor the session sandbox tier in /v1/runs - #715
Conversation
Signed-off-by: Jeremy Cohn <[email protected]>
clawgenti
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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)
| cap: promptTimings.cap, | ||
| ttlMs: promptTimings.ttlMs, | ||
| remoteSandbox: process.env.SH_REMOTE_SANDBOX === '1', | ||
| tier: config?.sandboxTier, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
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.
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]>
Summary
POST /v1/runsignored the session's sandbox tier: knative-server putssandboxTierin theconfig it hands
runLeaf, but the prompt, solve and verdict leaves never passed it toselectPoolSandbox, so every run used the default tier while/v1/turnhonored it. This passesconfig.sandboxTieras the selection tier in all three leaves. A session with no tier isunchanged. A microVM-tier run that names a workload now fails with a non-retryable
WorkloadSandboxMisconfiguredErrorinstead of silently running in the container tier, since workload sandboxes are container-only.
Checklist
git commit -s).make lintand the tests for the touched packages pass.docs/page, with the right maturity label (seedocs/CONTRIBUTING-DOCS.md). (n/a: bug fix)make check-linkspasses if any Markdown changed. (n/a)docs/specs/README.mdordocs/adrs/README.md. (n/a)