Repository navigation
Add daily sbx CLI drift check against skills and docs - #149
Conversation
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>
There was a problem hiding this comment.
🟡 Changes recommended
Adds a daily check for drift between sbx help, skills, and docs. Incomplete inputs can currently produce a clean result.
4 findings
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" |
There was a problem hiding this comment.
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 []: |
There was a problem hiding this comment.
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})::" |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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


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`:
The Hub/gateway credentials are never passed to the `sbx` binary.
Local run against v0.54.1
10 incoherences found, e.g.:
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.