Skip to content

fix: don't emit unused stdlib imports into vendored runtime bundles - #106

Merged
open-coder-ai merged 1 commit into
mainfrom
fix/runtime-bundle-unused-import
Sep 4, 2026
Merged

fix: don't emit unused stdlib imports into vendored runtime bundles#106
open-coder-ai merged 1 commit into
mainfrom
fix/runtime-bundle-unused-import

Conversation

@open-coder-ai

Copy link
Copy Markdown
Owner

What

chock.gate.runtime_bundle.render() spliced one fixed _chock_-renamed stdlib import block (os, shlex, shutil, subprocess, datetime, timezone, Path) into every agent's vendored runtime bundle, regardless of which of those names the assembled handler source (guard_runner + optionally sessionstart) actually referenced. shutil is used only by sessionstart, which is extracted for claude_code alone — so every other vendor's .chock/bin/<agent>.py carried a dead import shutil as _chock_shutil.

Surfaced by CodeQL in chock-catalog#56 — the first time that repo's adoption pipeline compiled the full nine-vendor set introduced by agentseam 0.2.1/chock 0.8.0 (previously only claude_code, cursor, vscode_copilot, and gate existed there).

render() now filters _IMPORTS per agent against what _handler_source(agent) actually references, instead of splicing it unconditionally.

Definition of done

  • chock check → 0 errors, 0 warnings, 0 infos
  • chock check --only matrix passes (no behavior change, matrix unchanged)
  • chock sync --repo . --check clean
  • chock check --only verify clean
  • Registry rescanned; no stale entries (no manifest changes in this PR)
  • pytest -q green (1058 passed, 3 skipped)
  • pytest acceptance/ -c acceptance/pytest.ini --rootdir=acceptance green
  • No existing artifacts need migration (no check added/extended, no manifest touched)
  • Changelog entry added (Unreleased). No version bump — a code-generation bugfix with no behavior/enforcement change, not a release itself.
  • ruff check . and ruff format --check . clean (on the touched file)

Claims

  • No surface is described as enforcing more than it installs — this only removes a dead import from generated output; the handler logic and every enforcement surface are byte-identical except for that one line, confirmed by diffing all 11 regenerated runtime goldens (9 changed, each losing exactly the import shutil as _chock_shutil line; claude_code and gate unchanged).

🤖 Generated with Claude Code

https://claude.ai/code/session_01RcphZmVVXoy8Jf2tUtcsC3


Generated by Claude Code

runtime_bundle.render() spliced the same fixed `_chock_`-renamed stdlib
import block into every agent's bundle, regardless of which of those
names the assembled handler actually referenced. `shutil` is only used
by `sessionstart`, extracted for claude_code alone, so every other
vendor's compiled runtime carried a dead `import shutil as
_chock_shutil` -- flagged by CodeQL in any adopter that compiles the
full vendor set (surfaced via chock-catalog#56, adopting this repo's
vendor coverage for the first time).

Filter the import block per agent against what its handler source
actually uses instead of splicing it unconditionally. Runtime goldens
regenerated: only the dead import line moved for the nine affected
agents (antigravity, codex_cli, cursor, devin, gemini_cli, grok,
tabnine, vscode_copilot, windsurf); claude_code's bundle is unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcphZmVVXoy8Jf2tUtcsC3
Signed-off-by: Open Coder AI <250249270+open-coder-ai@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 9e74bbb5-7e45-45c0-aa65-7faeec2690c3


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@open-coder-ai
open-coder-ai marked this pull request as ready for review September 4, 2026 00:32
@open-coder-ai
open-coder-ai merged commit 2f6d40a into main Sep 4, 2026
16 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.

1 participant