Skip to content

✨ Sandbox kicks get hive's relays (hive-review) on PATH from the hive image - #18519

Merged
kubestellar-prow[bot] merged 3 commits into
v5from
feat/18512-sandbox-relay-tools
Nov 16, 2026
Merged

kubestellar-prow[bot] merged 3 commits into
v5from
feat/18512-sandbox-relay-tools

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #18512

What

Hive now supplies its sandbox-safe relays itself on every sandboxed agent kick, so a project image no longer needs to include hive-review. Today hive-review is the only relay that works from a sandbox, through the review spool from #14986.

  • Job runtime (crux/kubejob). An init container named hive-relays uses the running hive image by digest. Hive reads its own pod through the existing pods get grant and takes the hive container's imageID. If that is not pullable it falls back to the image ref. Hive's imagePullSecrets are copied onto the Job.
    • The init container copies /usr/local/bin/hive-review into a 16Mi emptyDir. The kick container mounts it read-only at /opt/hive/relays.
    • Restricted SCC and PSS restricted: runAsNonRoot, readOnlyRootFilesystem, allowPrivilegeEscalation: false, all capabilities dropped, RuntimeDefault seccomp.
    • The uid is left unset on OpenShift, detected from the openshift.io/scc annotation on hive's own pod. Elsewhere it is 65534, because the hive image defaults to root.
    • New job.relay_image (none opts out) and job.relay_run_as_user fields.
    • If hive cannot read its own pod, the kick fails with a message naming both fields, and no Job is created.
  • Podman (crux/sandbox). Hive copies its own hive-review (from its PATH or $HIVE_SANDBOX_RELAY_DIR) into a private temp dir, bind-mounts it ro,Z and removes it after the run.
  • Preflight. On both runtimes the kick command is wrapped in a /bin/sh preflight. It fails the kick with exit 78 and a clear message when bash or python3 is missing, then prepends /opt/hive/relays to PATH and execs the command.
  • Precedence. Hive's copy always wins over one baked into the image, because the relay and the spool protocol ship together. This is documented in sandbox-isolation.md.
  • The relays are requested only for the agent kick launch (LaunchSpec.Relays). Verify runs, contained runs and the terminal viewer are unchanged.
  • src/Dockerfile already installs bin/hive-review.sh as /usr/local/bin/hive-review, so no image change was needed.

Follow-up

OpenShell and Substrate are not wired yet. Their pods are built by the gateway or the actor API, and need an init container plus Landlock read access. The doc says so, and those runtimes still need hive-review in the image.

Tests

  • crux/kubejob/relays_test.go: the Job spec on a vanilla cluster and on OpenShift (init container, digest, volume, read-only mount, wrapped command, security context, pull secrets), configured overrides, opt-out, failure messages, image selection and pod-name fallbacks.
  • crux/sandbox/relays_test.go: the Podman args mount, staging and cleanup, a missing relay, and the preflight run under a real /bin/sh with and without python3.

🤖 Generated with Claude Code

Job runtime: an init container from the running hive image (by digest,
read from hive's own pod) copies hive-review into an emptyDir that the
kick container mounts read-only at /opt/hive/relays. The init container
is restricted-SCC safe: runAsNonRoot, read-only root filesystem, no
privilege escalation, all capabilities dropped; the uid is left to the
SCC on OpenShift and is 65534 elsewhere. job.relay_image and
job.relay_run_as_user override, relay_image: none opts out.

Podman: hive stages its own hive-review in a private temp dir and
bind-mounts it read-only.

Both wrap the kick command in a /bin/sh preflight that fails the kick
(exit 78) with a clear message when bash or python3 is missing, and
prepends the relay dir to PATH.

Fixes #18512

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#18522 ✨ Sandboxed reviewers get the PR: head checked out plus PR metadata and diff CONFLICT src/crux/agent/manager_sandbox.go
src/crux/agent/sandbox_executor.go
src/docs/sandbox-isolation.md (conflict)
#18521 ✨ Reference repos: per-hive write identity, bot / bot only / owner (backend) (#18516) same files src/pkg/dashboard/settings_parity_allowlist.txt
#18507 ✨ governor: release-feed watcher kicks agents when a tracked upstream dependency releases same files src/pkg/dashboard/settings_parity_allowlist.txt
#18542 🐛 hive never applies hold itself: gates use ready-for-review / decision-needed same files src/pkg/dashboard/settings_parity_allowlist.txt
#18505 ✨ Discover agents declared in a managed repo's .hive/agents/ behind owner approval same files src/pkg/dashboard/settings_parity_allowlist.txt

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • coverage

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Mutation testing

❌ gremlins did not produce a report for 2 package(s), so no verdict can be derived from this run (see the job log):

  • crux/agent: gremlins exited 1
  • crux/sandbox: gremlins exited 1

gremlins found 5 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.

File Line Mutation
src/crux/kubejob/client.go 43 CONDITIONALS_NEGATION
src/crux/kubejob/client.go 51 ARITHMETIC_BASE
src/crux/kubejob/client.go 55 CONDITIONALS_BOUNDARY
src/crux/kubejob/client.go 71 CONDITIONALS_BOUNDARY
src/crux/kubejob/relays.go 190 CONDITIONALS_NEGATION

Verdict: error (#17349).

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 16, 2026
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 16, 2026
@clubanderson

Copy link
Copy Markdown
Member Author

cc @joerunde: this is part of the hive changes for the spyre-inference deps agent and sandboxed reviewer setup.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow
kubestellar-prow Bot merged commit c277986 into v5 Nov 16, 2026
105 of 108 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/18512-sandbox-relay-tools branch November 16, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Sandbox kicks get hive's agent relays (hive-review) on PATH without baking them into the project image

1 participant