Skip to content

fix: open-issue triage, first session (#190, #191, #192, #182, #173 item 3) - #226

Merged
pdettori merged 10 commits into
rossoctl:mainfrom
pdettori:fix/issue-triage-first-session
Sep 6, 2026
Merged

pdettori merged 10 commits into
rossoctl:mainfrom
pdettori:fix/issue-triage-first-session

Conversation

@pdettori

@pdettori pdettori commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Summary

The first session of the 2026-09-05 open-issue triage: the Tier 1 gate fixes, the
security-hygiene quick win, and the Tier 2 correctness item that needed a decision.

Closes #191, #190, #192, #182. Addresses item 3 of #173.

Six commits, one issue each (two for #173), each green on its own. Every commit
message records what was verified and what was not.

What's here

#191 — one recursive typecheck run. make typecheck and CI each carried their own
package list and had drifted in both directions: config-bundle was checked only by
the Makefile, sandbox-relay and ibac-stub only by CI. Both now call
pnpm -r typecheck.

Two findings widened this past the issue:

  • packages/session-backend and packages/work-queue ship TypeScript with no
    tsconfig.json at all
    — checked by neither the Makefile nor CI, and harness
    depends on both. So nine packages needed the script, not seven. Both were
    zero-error, so coverage was free.
  • pnpm -r <script> silently skips a package that doesn't declare the script and
    still exits 0. Before this PR, pnpm -r typecheck reported success while checking
    2 of 9 packages — the same failure mode as make typecheck covers 4 packages; CI typechecks 6 — a local green can hide a CI failure #191, one level down. A new guard test
    reads the members from pnpm-workspace.yaml and pins all three ways a package can
    fall out of coverage.

#190 — harness/test is typechecked. Flipping "include": ["src"] to
["src", "test"] surfaced 33 errors across 8 files, mostly hand-built fakes that
had drifted from the interfaces they claim to implement: FakeStore declared
implements LogStore without positionOfId; the WorkQueue fake was missing three
methods; both TurnSandbox fakes omitted the required context; a LeafResultRecord
omitted the required usage, so a round-trip assertion never covered that field;
run-leaf-promoted.test.ts read r.reason/r.message after a non-narrowing
expect(r.status); and one @ts-expect-error suppressed nothing.

None of these was a dead assertion — all ran and asserted. What was missing is that
nothing checked they asserted against the real contracts.

#192 — kube-context default. ?? 'kind-kagenti' → || undefined, matching what
config.ts and resolve-pod.ts already do and what the README already documents. No
new test, and the commit says why: the line is inside a describe.skipIf gate CI never
runs.

#173 item 3 — tokens out of Deployment specs. worker-deployment.yaml's
SANDBOX_TOKEN: __TOKEN__ sed put the live token into the spec, oc describe, and any
GitOps mirror. It now reads a Secret. The same script's
oc set env deploy/sandbox-relay SH_RELAY_TOKEN=$TOKEN put the identical token into the
relay's spec, so fixing only the worker would have left the leak open one Deployment
over — that now points at the same Secret.

One Secret, one key, read by both sides: fail-closed auth requires the two values to be
equal, and a shared key makes that structural instead of something a test compares.

The OCP overlay gets a patch rather than the base being changed. relay-deployment.yaml
is applied bare by demo-remote-worker.sh, relay-leaf-smoke.sh and README-worker.md's
Step 1, and relay auth is fail-closed — a base referencing a Secret would turn "Secret
not created yet" into "every Attach rejected" on all of those paths. value: null turned
out to be load-bearing, verified against real kustomize builds both ways.

#182 — one default exec timeout across all three transports. KubectlTransport and
persistentExecInPod armed no timer at all; GrpcRelayTransport applied 120 s. Nothing
pinned either, so the same model-issued bash ran forever on a pod and died at two
minutes through a relay.

One fact inverts the issue's framing: Pi's bash tool declares timeout Optional and
tells the model there is "no default timeout", and Pi's own local executor arms a
timer only when it's set. So KubectlTransport matched Pi and the relay was the
outlier — the opposite of what fixing the pod path to 120 s would have assumed.

DEFAULT_EXEC_TIMEOUT_S (30 min) now sits beside DEFAULT_OUTPUT_CAP and is applied by
all three. Deliberately generous: it exists so an exec can't leak a slot forever, not to
police runtime — a cold npm ci or a full test suite can outrun two minutes, and the
relay's ceiling failed those on the remote path only. timeout: 0 opts out, now
uniformly (it previously disarmed on two transports and silently fell back to 120 s on
the third; nothing in the repo passes 0).

Verification

make typecheck (9/9 packages), make test (all TS suites, the Go worker tests, and
make test-deploy) and make lint all pass on the final commit.

Every new guard was verified failing first, not just passing:

  • the coverage guard fails with exactly ['harness'] when the old include is restored
  • the token check fails with expected '__TOKEN__' to be undefined on the old literal
  • the overlay checks fail when the patch is unwired or its value: null removed
  • the timeout conformance case fails for KubectlTransport with the old unbounded behaviour

Not verified: the oc calls in remote-worker/deploy-incluster.sh. There is no
cluster-free harness for remote-worker/ scripts and I had no OCP cluster — shellcheck
and the manifest coupling tests are the coverage there.

A regression an existing test caught: deriving the gRPC timer from a seconds label
quantized opts.deadlineMs, so the existing "harness deadline fires independently of
worker timeout_s" test's 500 ms became 1 s. The timer stays in milliseconds; only the
error label is seconds.

Notes for review

Review follow-ups

Four commits on top address the review:

  • f4e0f77 (the blocker) — setup-ocp.sh now creates sh-relay-token. The overlay
    patch made it a hard requirement, but the script that applies that overlay never
    created it, so a fresh OCP install left the relay in CreateContainerConfigError —
    silently, since setup-ocp.sh doesn't rollout status the relay. Generated rather than
    dev-token, and never overwritten when present so a re-run can't rotate a token out
    from under an attached worker. New check reads the name/key out of the patch and asserts
    the script creates them; verified failing first.
  • 334be0e — a rotation defect I found while verifying the blocker, not raised in
    review. Env from a secretKeyRef is resolved only at pod start, and oc set env --from=secret/... is a no-op on a re-run, so a rotated token left both pods serving the
    old one. They stay stale together and keep matching, so it's invisible until either pod
    restarts alone and fail-closed auth rejects everything. Both Deployments now get an
    explicit rollout restart.
  • 22d696b — the wire now carries DEFAULT_EXEC_TIMEOUT_S too. runner.go:117 arms
    its timer only when TimeoutS > 0, so timeout_s: 0 told the worker "unbounded" while
    the harness held the timer alone. My "enforced end-to-end" claim was too strong: it held
    only while the harness survived to send the Abort. Three cases pin the wire value, which
    nothing did before.
  • cd4df9f — caveats on the three documented set env SH_RELAY_TOKEN= commands, which
    would swap the secretKeyRef back to a literal in the live spec.

One correction: CLAUDE.md:87 is headed "Commit Attribution" and specifies
Assisted-By: Claude (Anthropic AI) <[email protected]>, not Assisted-By: Claude Code. Using the string CLAUDE.md actually gives, matching the commits.


Assisted-By: Claude (Anthropic AI) [email protected]

`make typecheck` and CI each carried their own package list, and the lists had
drifted in both directions: packages/config-bundle was checked only by the
Makefile, packages/sandbox-relay and packages/ibac-stub only by CI. Both call
sites now run `pnpm -r typecheck`, so the covered set is whichever packages
declare the script and there is no second list to fall out of sync with.

Two packages turned out to be checked by neither. packages/session-backend and
packages/work-queue ship TypeScript with no tsconfig.json at all, so nine
packages needed the script, not the seven a straight reading of the issue
implies. Both typecheck clean today, so bringing them into coverage cost
nothing beyond the tsconfig.

The recursive form has a quieter version of the same failure mode: `pnpm -r
<script>` skips a package that does not declare the script, silently, and still
exits 0. Before this change `pnpm -r typecheck` reported success while checking
2 of 9 packages. harness/test/typecheck-coverage.test.ts closes that -- it reads
the workspace members from pnpm-workspace.yaml rather than hardcoding them, and
asserts every package carrying TypeScript has both a tsconfig.json and a
`typecheck` script.

Verified: `pnpm -r typecheck` covers 9 of 9 packages (was 2) and exits 0;
`pnpm -r test` and `make lint` clean.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…soctl#190)

harness/tsconfig.json was `"include": ["src"]`, so the package typechecked green
while none of its test files were read. That is the boundary the repo's design
arguments stop at: "a required field means a fourth implementation is a compile
error" only holds if the fakes are compiled too, and they were not.

Flipping the include surfaced 33 errors across 8 files. Most were hand-built
fakes that had drifted from the interfaces they claim to implement:

  - buffered-redis-backend.test.ts: FakeStore declares `implements
    LogStore<FileEntry>` without positionOfId, which the interface requires and
    checkpoint-extension.ts calls on the real store. Implemented it the same way
    rather than narrowing what the fake claims to be.
  - leaf-job-runner.test.ts: the WorkQueue fake was missing deleteConsumer,
    gcIdleConsumers and reapDeadLetters. processOne drives none of them (the
    consumer lifecycle is knative-server/src/leaf-job.ts), so they throw rather
    than no-op -- a stub that quietly succeeds would hide the day one is reached.
  - run-turn-sandbox.test.ts: both TurnSandbox fakes omitted `context`, a
    required key on K8sSandboxConfig.
  - leaf-result-store.test.ts: the round-trip record omitted the required
    `usage`, so the round-trip assertion never covered that field.
  - run-leaf-promoted.test.ts: `expect(r.status).toBe('failed')` asserts at
    runtime but does not narrow, so the `r.reason` / `r.message` reads after it
    were unchecked. expectStatus() now asserts and narrows in one step. okTurn is
    typed as the real executeTurn dep, which is what makes the mock.calls[0][0]
    promotedConfig assertions check against ExecuteTurnInput instead of against
    whatever shape the fake happens to have -- and that in turn showed one site
    reading through an optional promotedConfig without asserting it arrived.
  - pool-live-smoke.test.ts: a @ts-expect-error that never suppressed anything.
    TS permits bracket access to a private member deliberately.

None of these was a dead assertion -- all of them ran and asserted. What was
missing is that nothing checked they asserted against the real contracts.

typecheck-coverage.test.ts grows the third check its header describes: every
package with a test/ directory must include it in its tsconfig, so this cannot
regress here or anywhere else. Verified it fails with exactly ['harness'] when
the old include is put back.

Verified: `pnpm -r typecheck` 9/9 packages exit 0, `pnpm -r test` and `make lint`
clean.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…ontext (rossoctl#192)

m3-live-smoke.test.ts fell back to the literal `kind-kagenti` when
KAGENTI_SANDBOX_CONTEXT was unset, pinning one developer's cluster name. On any
other cluster that is worse than having no default: the suite ran against a
context that does not exist instead of where the operator was already pointed.

Unset now means undefined, which is what config.ts:25 and resolve-pod.ts:69
already do with this variable, what packages/k8s-sandbox/README.md already
documents as the default, and what kubectl treats as current-context.
kubectlExecRaw already appends --context only when cfg.context is truthy, so the
option is simply omitted -- no subprocess needed to look the context up.

No new test: the changed line sits inside a `describe.skipIf(!LIVE)` gated on
M3_LIVE_SMOKE, so nothing in CI can observe it. The behaviour it now matches is
pinned, by packages/k8s-sandbox/test/config.test.ts.

SMOKE.md needs no change -- its two `kind-kagenti` mentions record the cluster a
past run used, and its invocation passes the variable explicitly.

Verified: `pnpm -r typecheck` exit 0, k8s-sandbox suite and `make lint` clean.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…holder (rossoctl#173)

worker-deployment.yaml carried `SANDBOX_TOKEN: __TOKEN__`, which deploy-incluster.sh
sed-substituted with the live token. The result persisted in the Deployment spec,
in `oc describe`, and in any GitOps mirror of the namespace -- readable by anyone
with get/list on Deployments there.

SANDBOX_TOKEN now arrives via secretKeyRef, and deploy-incluster.sh creates the
Secret with `create --dry-run=client | apply` so re-running rotates the value
instead of failing on an existing Secret. The same script's

  oc set env deploy/sandbox-relay SH_RELAY_TOKEN=$TOKEN

put the identical token into the *relay's* spec, so fixing only the worker would
have left the leak open one Deployment over; it now points the relay at the same
Secret with `--from=secret/...`.

One Secret, one key. The relay's SH_RELAY_TOKEN and the worker's SANDBOX_TOKEN
must be equal -- auth is fail-closed, so a mismatch rejects every Attach -- and
sourcing both from a single key makes that structural rather than something a test
has to compare. That is why the key is named SH_RELAY_TOKEN even on the worker
side, which the manifest comment explains.

The token does still appear on deploy-incluster.sh's argv for the life of the `oc
create secret` call, visible to `ps` on the machine running the deploy. That is
the standard tradeoff for --from-literal and is noted in the script; it is a
world away from persisting in cluster state.

worker-deployment.test.ts drops __TOKEN__ from the placeholder list -- which
previously asserted the leak was present -- and gains a check that SANDBOX_TOKEN
has no literal `value` and that its secretKeyRef name/key match what the script
creates. The manifest and the script are different files in different languages,
so nothing else keeps them agreeing. Verified it fails ("expected '__TOKEN__' to
be undefined") with the old literal restored.

deploy/knative/worker-example.yaml keeps its matching `dev-token` literal: it is
the third-party copy-and-edit surface for the Kind path, paired with the base
relay manifest's public dev value, and relay-deployment.test.ts pins that pair.
The next commit closes the OCP side, where that literal is a real credential.

Verified: `pnpm -r test` and `pnpm -r typecheck` clean, `make test-deploy` PASS,
shellcheck -x -S warning clean on deploy-incluster.sh, `make lint` clean.
Not verified: the `oc` calls themselves -- there is no cluster-free harness for
remote-worker/ scripts, and I have no OCP cluster here.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…ossoctl#173)

relay-deployment.yaml declares `SH_RELAY_TOKEN: dev-token`. That literal is a
deliberate, documented public value for Kind -- but the same file is a shared
resource of overlays/ocp, so it was also a live credential on any OCP-deployed
relay, sitting in the Deployment spec for anyone with get/list on Deployments in
the namespace. The manifest's own comment names this as a prerequisite for
non-dev OCP worker use.

Patched in the overlay rather than the base. The base is applied bare
(`kubectl apply -f relay-deployment.yaml`) by demo-remote-worker.sh,
relay-leaf-smoke.sh and README-worker.md's Step 1, and relay auth is fail-closed
-- so a base that referenced a Secret would turn "Secret not created yet" into
"every worker Attach rejected" on all of those paths. The overlay is where the
divergence belongs, and it is where the exposure actually is.

The patch reads the same Secret and key as the worker's SANDBOX_TOKEN, so the
equality fail-closed auth requires is structural rather than a literal a test
compares.

`value: null` is load-bearing. Strategic merge keeps fields it is not told to
remove, and an env entry carrying both value and valueFrom is rejected by the API
server. Verified against a real build: with the null, `kubectl kustomize
--load-restrictor LoadRestrictionsNone deploy/knative/overlays/ocp` emits
SH_RELAY_TOKEN as a bare secretKeyRef; without it, the output carries
`value: dev-token` AND the valueFrom. The Kind base still builds with the
dev-token literal, unchanged.

Three checks in relay-deployment.test.ts, all verified failing first: the patch is
wired into the overlay, its value is null (message names the consequence), and its
Secret name/key match remote-worker/deploy-incluster.sh. The third is a sweep over
every directory in overlays/ -- today only ocp consumes the relay, and without
that sweep the next overlay to add it would inherit the dev-token silently, which
is this same bug one directory over.

Verified: `pnpm -r test`, `pnpm -r typecheck` and `make lint` clean, and both
kustomize builds inspected directly.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…ossoctl#182)

The three SandboxTransport implementations disagreed about what "no timeout"
means. KubectlTransport and persistentExecInPod armed no timer at all, so a
command ran unbounded; GrpcRelayTransport applied a local 120 s deadline. Nothing
pinned either behaviour -- conformance.ts only ever passed an explicit
`timeout: 2` -- so the same model-issued `bash` ran forever on a pod and died
after two minutes through a relay, decided by which transport happened to serve
it. Callers above the seam cannot see or control that.

Pi's bash tool makes this the ordinary case, not an edge one: `timeout` is
Optional and its description tells the model there is "no default timeout", and
Pi's own local executor arms a timer only when it is set. So KubectlTransport
matched Pi and it was the relay that diverged -- the opposite of what fixing the
pod path to 120 s would have assumed.

DEFAULT_EXEC_TIMEOUT_S (30 minutes) now lives beside DEFAULT_OUTPUT_CAP in
transport.ts and is applied by all three. It is deliberately generous: it exists
so an exec cannot leak a slot forever, not to police how long a command may
legitimately take. A cold `npm ci`, a full test suite or a container build can all
outrun a two-minute budget, and the relay's 120 s ceiling was low enough to fail
those on the remote path only. Callers that know better still pass their own
`timeout`, and an explicit `timeout: 0` opts out entirely -- now uniformly, where
previously 0 disarmed the timer on two transports and silently fell back to the
120 s deadline on the third. Nothing in the repo passes 0.

Two conformance cases, so this cannot drift again: the default applies when no
timeout is named (asserting still-pending just short of the ceiling, so a
transport that timed out early or armed 120 s cannot pass), and an explicit 0
arms nothing (advancing well past the ceiling). Verified the first fails for
KubectlTransport with the old unbounded behaviour restored.

The existing "harness deadline fires independently of worker timeout_s" test
caught a regression I introduced on the way: deriving the gRPC timer from a
seconds label quantized opts.deadlineMs, so that test's 500 ms became 1 s and the
timer fired late. The timer stays in milliseconds; only the error label is
seconds.

Left alone deliberately: the `timeoutS` field sent to the Go worker still passes
through whatever the caller asked for (0 when unspecified). The client already
cancels the call and sends an Abort on deadline, which kills the remote process
group, so the ceiling is enforced end-to-end without changing the wire contract.

Verified: `pnpm -r test` (k8s-sandbox up 6 = 2 new cases x 3 transports),
`pnpm -r typecheck` exit 0, `make lint` clean.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@pdettori pdettori left a comment

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.

Review: 1 must-fix, 2 suggestions

(Submitted as a comment rather than REQUEST_CHANGES only because GitHub rejects both verdicts from the PR author. Treat comment 1 as blocking.)

Strong PR. The #191/#190 work found two real coverage holes past the issue as filed — pnpm -r silently skipping 2 of 9 packages, and 33 type errors in fakes that declared implements on interfaces they didn't satisfy — and the guards are verified-failing-first rather than merely passing. The #182 reasoning correctly inverts the issue's framing (the relay was the outlier, not the pod path). I checked the typecheck-coverage arithmetic independently: 9 workspace members from pnpm-workspace.yaml, config-bundle and harness already declared the script, 7 added here — no gap, and the guard would catch a tenth.

One blocker: the OCP overlay's new Secret prerequisite isn't satisfied by the script that applies that overlay.

Areas reviewed: TypeScript, Kustomize/K8s manifests, Shell, CI, Docs
Agent/IDE config (.claude/.vscode): none
Commits: 6, all signed off, all conventional prefixes
CI: 12/12 passing

Nit

The body footer says "🤖 Generated with Claude Code". Both this repo's CLAUDE.md:87 and the hub convention call for Assisted-By: Claude Code in PR descriptions — the work is yours, Claude Code assists.

Not blocking, on the split question

It reviews fine as one PR: six commits, one issue each, and the two deploy commits (#173) genuinely need to land together — fixing only the worker would have left the leak open one Deployment over, as the body notes. No need to split.


# The base's SH_RELAY_TOKEN literal is a Kind dev value; on OCP it would be a real
# credential in the Deployment spec. See patch-relay-token.yaml (#173).
- path: patch-relay-token.yaml

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.

must-fix — this overlay now hard-requires Secret sh-relay-token, but nothing on the path that applies the overlay creates it.

overlays/ocp lists ../../relay-deployment.yaml in resources, and setup-ocp.sh is what renders and applies this overlay (README-ocp.md, and README-worker.md:254 documents the same oc kustomize … overlays/ocp | oc apply -f -). setup-ocp.sh creates llm-credentials and ab1-llm-cred, but not sh-relay-token — the only creator in the repo is remote-worker/deploy-incluster.sh, a remote-worker demo script that also requires deploy/sandbox-relay to already exist.

So on a fresh OCP install the relay pod never starts: CreateContainerConfigError, missing secret. setup-ocp.sh doesn't rollout status the relay, so it won't fail loudly — it just leaves a broken Deployment behind, and the failure is harder to diagnose than the token mismatch the patch is avoiding.

This is the same argument the patch header makes against changing the base ("a base that referenced a Secret would turn 'Secret not created yet' into 'every worker Attach rejected'"), applied to the overlay's own applier. The header covers the three bare-base appliers — demo-remote-worker.sh, relay-leaf-smoke.sh, README Step 1 — but setup-ocp.sh applies the overlay, so the reasoning that protects the base doesn't reach it.

The new tests can't catch this: they pin manifest↔script coupling (overlay ↔ deploy-incluster.sh), not that whoever applies the overlay creates the Secret.

Suggested fix: create it idempotently in setup-ocp.sh next to llm-credentials, with the same create --dry-run=client | apply shape deploy-incluster.sh uses and the same name/key. A secretGenerator in the overlay would be self-contained but would clobber a rotated token on every re-apply, so the script is the safer side to fix.

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.

Fixed in f4e0f77. Confirmed every step of this before changing anything: setup-ocp.sh sets OVERLAY_DIR to overlays/ocp (:32) and applies it via render_overlay_dir (:455-460); it creates ab1-llm-cred, llm-credentials and ab2-egress-cred but not sh-relay-token; and it rollout statuses the sandbox controller, authbridge-ab1, ibac-stub and echo-target — not the relay. So the silent-broken-Deployment outcome is exactly right.

Created in setup-ocp.sh with the create --dry-run=client | apply shape and the same name/key, as suggested. Two choices worth flagging:

  • Generated, not dev-token. Defaulting to the repo's public dev value would have satisfied the manifest while keeping the thing the patch exists to remove. SH_RELAY_TOKEN pins a specific value when a worker needs a known one, and the script prints the oc get secret … | base64 -d line to read it back.
  • Never overwritten when already present. Same reasoning you gave against secretGenerator: a re-run must not rotate a token out from under an attached worker. secretGenerator clobbers on every apply; an unconditional create | apply here would too.

Also took your point that the existing checks structurally cannot see this. The new one reads the Secret name and key out of patch-relay-token.yaml itself and asserts setup-ocp.sh creates that name with that key, so it follows the reference rather than restating it. Verified failing first with the creation removed: expected '#!/usr/bin/env bash…' to contain 'create secret generic sh-relay-token'.

Verifying this turned up a second defect in the same area, fixed in 334be0e: env from a secretKeyRef is resolved only at pod start, and oc set env --from=secret/... is a no-op on a re-run, so deploy-incluster.sh rewriting the Secret left both pods on the old token. Invisible while both are stale together — they still match — until one restarts alone and fail-closed rejects every Attach. Both Deployments now get an explicit rollout restart. The old set env SH_RELAY_TOKEN=<literal> had masked it by changing the spec every time.

// The timer stays in milliseconds. Deriving it from the seconds label instead would
// quantize deadlineMs -- a sub-second deadlineMs (the tests use 500) rounds to a whole
// second and the timer fires late or not at all.
const timeoutMs = execOpts.timeout !== undefined ? execOpts.timeout * 1000 : deadlineMs;

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.

suggestion — the shared ceiling is armed harness-side only, on the one transport whose process is remote.

Line 58 still sends timeoutS: execOpts.timeout ?? 0, and remote-worker/internal/exec/runner.go:117 arms its own timer only if s.TimeoutS > 0 (its comment at line 46 spells out the TimeoutS == 0 outlives-us case). So for the newly-covered case — caller names no timeout — the worker is told "unbounded" while the harness holds the 30-minute timer alone.

On KubectlTransport and persistentExecInPod the timer and the child live in the same process, so the ceiling can't be orphaned. Here it can: if the harness exits, the connection drops, or the client.abort never lands, the remote process runs forever — which is the slot leak DEFAULT_EXEC_TIMEOUT_S exists to stop, per its own docstring.

timeoutS: execOpts.timeout ?? DEFAULT_EXEC_TIMEOUT_S would make the ceiling hold independently on both sides, and keeps timeout: 0 meaning "no timeout" on the wire too. Worth a conformance-style case if you take it, since the wire value isn't currently pinned by anything.

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.

Taken, in 22d696b — timeoutS: execOpts.timeout ?? DEFAULT_EXEC_TIMEOUT_S.

Verified the premise: runner.go:117 arms context.WithTimeout only if s.TimeoutS > 0, and the drainGrace comment at :46 names the TimeoutS == 0 outlives-us case explicitly.

The part I got wrong was in my own commit message, which said the ceiling was "enforced end-to-end without changing the wire contract" because the client cancels and sends an Abort. That only holds while the harness survives to send it — which is the case a ceiling against slot leaks most needs to cover. The same-process argument for the two kubectl transports is what made the asymmetry easy to miss.

Added the conformance-style cases you asked for. They live in grpc-relay-transport.test.ts rather than conformance.ts, since the wire value isn't expressible in a transport-agnostic battery — and that's precisely why nothing caught this: the battery pins what the caller observes, which cannot distinguish a ceiling both ends enforce from one only we do. Three cases: unspecified sends the ceiling, an explicit timeout goes through verbatim, and timeout: 0 sends 0 so unbounded stays unbounded on both ends. Verified failing first — expected +0 to be 1800.

Also extended the DEFAULT_EXEC_TIMEOUT_S docstring to say the gRPC transport puts it on the wire and why this is the transport where it matters, so the next reader doesn't have to reconstruct the argument.

# `value: null` deletes the literal the base sets; strategic merge alone would leave both fields
# present, which the API server rejects (value and valueFrom are mutually exclusive).
#
# Create the Secret before applying this overlay -- remote-worker/deploy-incluster.sh does it,

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.

suggestion — two docs still instruct the command that undoes this patch.

README-worker.md:60 (Step 1) and docs/demos/remote-sandbox-demo.md:127 both say:

oc set env deploy/sandbox-relay SH_RELAY_TOKEN=dev-token -n default

kubectl set env replaces the matching EnvVar entry wholesale rather than merging into it, so running Step 1 against an overlay-deployed relay silently swaps valueFrom.secretKeyRef back to value: dev-token — reintroducing exactly the leak #173 is about, in the live spec, where no manifest test can see it. README-worker.md:403's troubleshooting row points at the same command.

Both docs are correct for the Kind/bare-base path they were written for, so this is a caveat rather than a rewrite: one line noting that on an OCP overlay deployment the token comes from the sh-relay-token Secret and should be rotated there (oc create secret … --dry-run=client | oc apply -f -), not via oc set env. Since #173 item 3 is specifically about tokens not living in Deployment specs, closing the documented path back into one seems in scope.

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.

Fixed in cd4df9f, as a caveat rather than a rewrite — agreed that both documents are correct for the Kind/bare-base path they were written for.

Verified all three sites: README-worker.md:60 (Step 1), its troubleshooting row at :403, and remote-sandbox-demo.md:127. And the mechanism is as you describe — set env replaces the matching EnvVar entry rather than merging into it, so on an overlay-deployed relay it swaps valueFrom.secretKeyRef for value: <token>. Worth stressing that this is the one place a manifest test can't help: it happens in the live spec, which no file in the repo describes.

Step 1 gets a note naming the Secret and giving the rotate-and-restart commands; the troubleshooting row points at that note; the demo's step 1b gets a "Kind only" caveat saying why set env is the right tool there and wrong on an overlay.

The restart in those instructions isn't incidental, and it's the same reason deploy-incluster.sh now restarts the relay (334be0e): rewriting the Secret alone would leave the running relay on its previous token, since env from a Secret is only read at container start.

… the overlay (rossoctl#173)

The overlay patch added in this branch makes Secret `sh-relay-token` a hard
requirement of overlays/ocp, but nothing on the path that applies that overlay
created it. `setup-ocp.sh` renders and applies overlays/ocp and creates
llm-credentials, ab1-llm-cred and ab2-egress-cred -- not this one. The only
creator was remote-worker/deploy-incluster.sh, a separate demo script that also
needs deploy/sandbox-relay to exist already.

So on a fresh OCP install the relay pod never started: CreateContainerConfigError,
missing secret. `setup-ocp.sh` does `rollout status` on four other Deployments but
not the relay, so it would not have failed loudly -- it would have left a broken
Deployment behind, and a harder failure to diagnose than the token mismatch the
patch exists to avoid.

This is the patch header's own argument -- "a base that referenced a Secret would
turn 'Secret not created yet' into 'every worker Attach rejected'" -- applied to
the overlay's applier rather than the base's. The header covered the three bare-base
appliers and missed that setup-ocp.sh applies the overlay.

Generated rather than defaulted to `dev-token`: the point of the patch is that an
OCP relay must not carry the repo's public dev credential. SH_RELAY_TOKEN pins a
specific value when a worker needs a known one. Never overwritten when already
present, so a re-run cannot rotate a token out from under an attached worker --
the same reason the overlay uses a patch rather than a kustomize secretGenerator,
which would clobber it on every apply.

The existing coupling checks could not catch this: they pin the overlay against
deploy-incluster.sh, not against whoever applies the overlay. The new check reads
the Secret name and key out of the patch itself and asserts setup-ocp.sh creates
that name with that key. Verified failing first -- "expected '#!/usr/bin/env
bash…' to contain 'create secret generic sh-relay-token'" with the creation
removed.

Verified: `pnpm -r test`, `pnpm -r typecheck`, `make lint` clean;
shellcheck -x -S warning clean on setup-ocp.sh.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
… Secret (rossoctl#173)

Moving both sides to a secretKeyRef introduced a rotation defect this branch did
not account for. Env from a secretKeyRef is resolved once, at container start --
unlike a mounted Secret, it is never refreshed in a running pod. And on a re-run
`oc set env --from=secret/...` changes nothing, because the spec already names the
Secret, so no rollout is triggered either.

The previous `oc set env deploy/sandbox-relay SH_RELAY_TOKEN=$TOKEN` happened to
mask this: writing a literal changed the spec, which rolled a new pod every time.

So a second run with a different SANDBOX_TOKEN rewrote the Secret while both pods
kept serving the old token. That is not immediately visible -- both sides stay
stale together and still match -- but the operator's requested token is silently
not in use, and the moment either pod restarts on its own the two disagree and
fail-closed auth rejects every Attach, for a reason nothing in either Deployment
spec explains.

Both Deployments now get an explicit `rollout restart` plus `rollout status`, so
the token the script was asked to install is the one actually in effect when it
exits. The worker's rendered Deployment is byte-identical between runs, so it
needs this for the same reason the relay does.

Verified: shellcheck -x -S warning clean, `make test-deploy` PASS, `make lint`
clean. Not verified: the `oc` calls themselves -- no cluster-free harness exists
for remote-worker/ scripts and I have no OCP cluster.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…-side (rossoctl#182)

The shared ceiling was armed only on our own timer while the request still carried
`timeout_s: 0` for the unspecified case. remote-worker/internal/exec/runner.go arms
its timeout solely when `TimeoutS > 0` -- its own comment at runner.go:46 spells out
the `TimeoutS == 0` outlives-us case -- so the worker was being told "unbounded"
while the harness held the 30-minute timer alone.

That matters on this transport specifically. On KubectlTransport and
persistentExecInPod the timer and the child live in the same process, so the
ceiling cannot be orphaned. Here it can: a harness that exits, a dropped
connection, or an `abort` that never lands leaves the remote process running with
nothing left to stop it -- which is precisely the slot leak
DEFAULT_EXEC_TIMEOUT_S exists to prevent, per its own docstring.

My earlier claim that the ceiling was "enforced end-to-end" because the client
cancels and sends an Abort was too strong: that holds only while the harness
survives to send it. Both ends now hold the same budget independently, and an
explicit `timeout: 0` still means unbounded on both.

Three cases pin the wire value, which nothing did before -- the conformance battery
asserts what the caller observes, and that cannot distinguish a ceiling both ends
enforce from one only we do. Verified failing first: the unspecified case reports
"expected +0 to be 1800" with `?? 0` restored.

Verified: `pnpm -r test`, `pnpm -r typecheck`, `make lint` clean.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…ef (rossoctl#173)

README-worker.md Step 1, its troubleshooting row, and remote-sandbox-demo.md step 1b
all instruct `set env deploy/sandbox-relay SH_RELAY_TOKEN=<value>`. `set env`
replaces the matching EnvVar entry wholesale rather than merging into it, so running
any of them against an overlay-deployed relay silently swaps the secretKeyRef back
for a literal -- putting a live token into the Deployment spec, which is the leak
rossoctl#173 removes, in the live spec where no manifest test can see it.

Both documents are correct for the Kind/bare-base path they were written for, so
this is a caveat rather than a rewrite: on an OCP overlay deployment the token comes
from the sh-relay-token Secret, and rotating means rewriting the Secret and
restarting the relay (env from a Secret is resolved only at pod start -- the same
reason deploy-incluster.sh now restarts it).

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori merged commit 1b5d4ef into rossoctl:main Sep 6, 2026
12 checks passed
@pdettori
pdettori deleted the fix/issue-triage-first-session branch September 6, 2026 12:29
pdettori added a commit that referenced this pull request Sep 6, 2026
§8's "Accepted divergences" still recorded the default-deadline divergence as open,
and all three of its claims became false when #226 landed: the kubectl path now has
a default, `GrpcRelayTransport` no longer applies 120 s, and the conformance battery
does see both. Left as-is, the live seam contract contradicted the seam.

The divergence entry is deleted rather than annotated, matching how the #181 and
#185 entries were handled when they were resolved -- it was the last one, so the
subsection and its justifying preamble go with it. In its place §8's dual-ended
timeout bullet now states the resulting contract: DEFAULT_EXEC_TIMEOUT_S applied by
all three implementations and sent as `timeout_s`, `timeout: 0` meaning unbounded on
both ends, and why the ceiling is set generously. The superseded behaviour stays
recorded there as history, since the reason the relay was the outlier -- Pi's bash
tool documents no default timeout -- is what makes the resolution make sense.

ADR-0024 gets a Revisions entry with the three rejected alternatives, per the
convention its earlier entries follow.

Convention note, flagged rather than assumed: docs/specs/README.md says a spec is
never retro-edited. §8 is the exception already taken twice on the same grounds --
it is the live seam contract, not a point-in-time record -- by #184 and by the
#180/#181/#185 change, whose own spec §6 spelled the reasoning out and explicitly
left "the #182 default-deadline divergence stays" for exactly this moment. The ADR
is append-only as always: a new Revisions entry, no edits above it.

Docs only -- no code, no test changes. Verified: `make lint`, `make test` and
`make typecheck` clean.

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.

make typecheck covers 4 packages; CI typechecks 6 — a local green can hide a CI failure

1 participant