Skip to content

Add daily sbx CLI drift check against skills and docs - #149

Merged
dgageot merged 1 commit into
docker:mainfrom
gtardif:sbx-drift-check
Nov 25, 2026
Merged

dgageot merged 1 commit into
docker:mainfrom
gtardif:sbx-drift-check

Conversation

@gtardif

@gtardif gtardif commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

What

New workflow `.github/workflows/sbx-drift.yml` (daily cron + `workflow_dispatch`, optional `sbx_version` input, default: latest release) running `scripts/check_sbx_drift.py`:

  1. Downloads the latest `docker/sbx-releases` linux tarball (binary only; `--help` needs no daemon, KVM, or sign-in).
  2. Walks the whole `sbx [--cloud] <cmd...> --help` tree (falls back to `sbx help ` for commands that require sign-in before `--help`; cloud pages kept only when they differ from local).
  3. Loads the `skills/docker-sandboxes-*` Markdown (minus eval runbooks) and the Markdown of every `docs.docker.com/ai/sandboxes/` page from the sitemap (release notes excluded).
  4. Asks Claude through the Docker AI Gateway — same bot credentials / token minting as the live evals, reusing `eval_judge.py` helpers — for `sbx` usage contradicting the help (streamed, extended thinking, help block prompt-cached across batches).
  5. Keeps a finding only if its quotes really appear in the sources, and probes the binary for `missing_command`/`missing_flag` findings: hidden commands/flags (`sbx --cloud schedule`, `sbx run --model`, `--app-name`...) are logged as ignored unless deprecated.
  6. Prints findings in the logs (plus `::error` annotations) and exits 1 when any remain (2 on infra/model errors).

The Hub/gateway credentials are never passed to the `sbx` binary.

Local run against v0.54.1

10 incoherences found, e.g.:

  • skill `docker-sandboxes-lifecycle`: `sbx ports` (now `sbx port ls/publish/unpublish`, `ports` is hidden+deprecated), `sbx run --detached` (is `--detach`), `sbx exec -d/--privileged` (don't exist), outdated built-in agent list
  • docs: `sbx start` (troubleshooting), `sbx ports --publish` (git workflow), `prune --filter since=` (usage), `sbx secret set aws` (opencode)

Takes ~5 min, 16 model calls.

Tests

`scripts/test_check_sbx_drift.py`: offline unit tests with a fake `sbx` (tree walk, sign-in fallback, secret stripping, hidden/deprecated probing, quote grounding, SSE parsing, exit codes) plus workflow guards. `task` passes; actionlint clean.

Walk the latest sbx release's --help tree (local and --cloud), and ask an
LLM through the Docker AI Gateway to list sbx usage in the Docker Sandboxes
skills and docs.docker.com/ai/sandboxes pages that contradicts it. Findings
are grounded (quotes must exist in the sources) and probed against the
binary (hidden commands/flags are ignored unless deprecated), logged, and
fail the run. Runs daily and on workflow_dispatch.

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
@gtardif
gtardif requested a review from a team as a code owner November 25, 2026 16:33

@docker-gordon docker-gordon Bot 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.

🟡 Changes recommended

Adds a daily check for drift between sbx help, skills, and docs. Incomplete inputs can currently produce a clean result.

4 findings

Medium severity An unreadable help page can produce a false successful check. · New

Medium severity A malformed model response can be reported as a clean audit. · New

Low severity Docs findings do not produce GitHub Actions error annotations. · New

Medium severity Splitting a long document can hide an invocation from the audit. · New

1 recommended validation
Check discovery of cloud-only commands.

What to check:

Extend the fake sbx to list a cloud-only subcommand with its own flag. Collect and merge both help trees, then assert that the rendered help includes that subcommand and flag.

Why:

The fake CLI strips --cloud and returns the local tree. The merge test uses synthetic pages, so neither test exercises discovery of a cloud-only command through collection and rendering.

Comment @docker-gordon help to see review commands.

if not path:
raise
print(f"warning: {e}", file=sys.stderr)
pages[name] = "(help unavailable in this environment; the command exists)\n"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Medium severity An unreadable help page can produce a false successful check.

If both help requests fail for a subcommand, collect_help substitutes a placeholder and stops walking that branch. The run can then report that the skills and docs are coherent even though it never checked that command's flags or descendants. Treat an unreadable help page as an incomplete check and return an infrastructure error.

Comment @docker-gordon help to see review commands.

Finding f_7d75a42

by_source = {d.source: normalize(d.text) for d in batch}
help_norm = normalize(help_text)
findings = []
for raw in reply.get("findings") or []:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Medium severity A malformed model response can be reported as a clean audit.

A valid JSON model reply such as {} has no findings list, but this loop treats it as an empty result. The affected batch is counted as checked, so the workflow can report coherence without receiving the requested audit result. Validate that the reply is an object containing a findings array and treat an invalid shape as a model error.

Comment @docker-gordon help to see review commands.

Finding f_db16ce3

print(f" fix: {f.suggestion}")
if in_actions:
location = f" file={f.source}" if not f.source.startswith("https://") else ""
print(f"::error{location},title=sbx drift ({f.command})::"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Low severity Docs findings do not produce GitHub Actions error annotations.

For a finding from a docs URL, location is empty, so this prints ::error,title=...:: instead of a workflow command with a space before its properties. GitHub Actions will not recognize it as an error annotation, although the finding still appears in the log and fails the run. Format the command with a space before title when there is no file property.

Comment @docker-gordon help to see review commands.

Finding f_8ee0696

for doc in docs:
parts = [doc]
if len(doc.text) > max_chars:
parts = [Document(f"{doc.source} (part {i // max_chars + 1})", doc.text[i:i + max_chars])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Medium severity Splitting a long document can hide an invocation from the audit.

For a document longer than 60,000 characters, a command or flag can cross the fixed character boundary. Each model call then receives only a fragment, so it cannot reliably check or quote the complete invocation. Split at document boundaries such as paragraphs, or overlap adjacent parts enough to preserve invocations across the boundary.

Comment @docker-gordon help to see review commands.

Finding f_f892c31

@dgageot
dgageot merged commit fbcef37 into docker:main Nov 25, 2026
5 checks passed
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.

3 participants