Skip to content

ExternalIP unit tests#3117

Closed
robbycochran wants to merge 25 commits intorc-claude-devfrom
claude/agent-1773900399-24020
Closed

ExternalIP unit tests#3117
robbycochran wants to merge 25 commits intorc-claude-devfrom
claude/agent-1773900399-24020

Conversation

@robbycochran
Copy link
Copy Markdown
Collaborator

  • X-Smart-Branch-Parent: master
  • docs: merge doc/ into docs/ with corrected inaccuracies
  • X-Smart-Branch-Parent: agent-doc
  • feat: add devcontainer and Claude Code agent development environment
  • docs: add Vertex AI setup and devcontainer build instructions to CLAUDE.md
  • feat: add launcher script with worktree isolation and GitHub PAT support
  • feat: use official GitHub MCP server, fix run.sh, add bubblewrap
  • refactor: convert skills to collector-dev plugin with scoped tool permissions
  • feat: create branch and draft PR upfront, tighten iterate permissions
  • feat: add watch-ci skill for CI monitoring loop
  • feat: add end-to-end task skill with CI monitoring loop
  • fix: load collector-dev plugin via --plugin-dir flag
  • feat: stream agent activity to stdout in autonomous mode
  • feat: add --local mode for debugging without worktree or PR
  • feat: add --headless mode (worktree + stream-json, no PR)
  • fix: initialize submodules in worktree after creation
  • fix: only init required submodules, drop --recursive
  • fix: headless mode now invokes /collector-dev:task skill like default mode
  • feat: add preflight checks with clear error messages
  • refactor: remove gh CLI dependency, agent creates PR via GitHub MCP
  • refactor: move skills from plugin to standalone, simplify CLAUDE.md
  • refactor: switch worktree to clone, consolidate to 2 skills, fix audit issues
  • fix: move git push deny to container-only settings
  • security: remove SSH mount, git push blocked by lack of credentials
  • fix: set clone remote to GitHub URL instead of local path

Description

A detailed explanation of the changes in your PR.

Feel free to remove this section if it is overkill for your PR, and the title of your PR is sufficiently descriptive.

Checklist

  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

TODO(replace-me)
Use this space to explain how you tested your PR, or, if you didn't test it, why you did not do so. (Valid reasons include "CI is sufficient" or "No testable changes")
In addition to reviewing your code, reviewers must also review your testing instructions, and make sure they are sufficient.

For more details, ref the Confluence page about this section.

robbycochran and others added 25 commits March 13, 2026 13:34
Consolidate all documentation under docs/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a devcontainer based on the collector-builder image that enables
agent-driven development of collector. The devcontainer includes all
C++ build dependencies, Go, Node.js, Claude Code, gcloud CLI, and
developer tooling (ripgrep, fd, gh).

Verified: cmake configure, full collector build, and 17/17 unit tests
pass inside the container. Claude Code authenticates to Vertex AI via
read-only gcloud credential mount.

- .devcontainer/: Dockerfile, devcontainer.json, network firewall
- CLAUDE.md: agent development guide with build/test workflows
- .claude/skills/: /build, /ci-status, /iterate slash commands
- .claude/settings.json: deny Read(.devcontainer/**) for security
- Security: bubblewrap sandboxing, npm hardening, read-only mounts,
  optional iptables firewall with NET_ADMIN

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…DE.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The run.sh script launches Claude Code in the devcontainer with:
- Git worktree isolation: agent works on its own copy, never touches
  the user's checkout. Worktree is cleaned up on exit.
- GitHub auth: supports fine-grained PAT via GITHUB_TOKEN or
  host gh CLI config (read-only mount)
- Modes: autonomous (-p task), interactive, shell, no-worktree

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace gh CLI and Docker-based MCP server with official GitHub MCP
  server at api.githubcopilot.com/mcp (OAuth, project-scoped .mcp.json)
- Add permissions.deny for dangerous MCP tools (merge, delete, fork)
- Add bubblewrap, socat, iptables to Dockerfile for sandboxing
- Remove gh CLI install from Dockerfile
- Fix run.sh: suppress git worktree output, use bash array for docker
  args instead of eval with string (fixes --interactive mode)
- Remove Docker socket mount and GITHUB_TOKEN forwarding from run.sh
- Update skills to reference mcp__github__* tools instead of gh CLI

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…missions

Move skills from .claude/skills/ to .claude/plugins/collector-dev/ as a
proper Claude Code plugin. Each skill now declares only the tools it needs
via allowed-tools frontmatter:

- /collector-dev:build — cmake, make, git describe, strip (no GitHub)
- /collector-dev:ci-status — git branch/log + GitHub MCP read-only tools
- /collector-dev:iterate — build tools + git + clang-format + GitHub MCP
  PR/push tools

The GitHub MCP server config moves from root .mcp.json into the plugin's
.mcp.json so it's bundled with the skills that use it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
run.sh now creates the branch, pushes it, and opens a draft PR before
launching the agent. The agent receives the branch name and PR URL in
its prompt and only needs to commit and push.

iterate skill drops all GitHub MCP write tools (create_branch, push_files,
create_pull_request, update_pull_request). It retains only read-only
GitHub MCP tools for checking CI status.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New skill that checks CI status and reacts to failures:
- PASSED: all checks green, stop
- PENDING: still running, wait for next loop
- FIXED: diagnosed failure, pushed fix, awaiting new CI
- FLAKE: infra issue, not code
- BLOCKED: needs human intervention

Usage: /loop 30m /collector-dev:watch-ci

Same restricted tool set as iterate — read-only GitHub MCP, build
tools, git push to existing branch only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New /collector-dev:task skill that runs the full lifecycle:
1. Implement the task (edit, build, unit test, format, push)
2. Monitor CI in a loop (sleep 10m, check status, fix failures)
3. Stop when all checks pass, or after 6 cycles (~3h)

Reports final status: PASSED, BLOCKED, or TIMEOUT.

run.sh now invokes /collector-dev:task directly so a single command
goes from task description to green CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code doesn't auto-discover plugins from .claude/plugins/.
Add --plugin-dir /workspace/.claude/plugins/collector-dev to all
claude invocations so skills like /collector-dev:task are available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use --output-format stream-json --verbose for autonomous task mode so
all messages (tool calls, responses, thinking) stream to container
stdout in real time. Interactive mode keeps the normal TUI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
--local edits the working tree directly with interactive TUI.
No worktree, no branch, no PR. For debugging and experimentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
git worktree add does not init submodules. Without this, cmake fails
because falcosecurity-libs and other submodules are missing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Only init falcosecurity-libs and collector/proto/third_party/stackrox.
The 17 builder/third_party/* submodules are baked into the builder
image and not needed for compiling collector. This avoids cloning
49 recursive submodules (was hanging on large repos like grpc).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… mode

Both headless and default task mode now use the same task_prompt()
that explicitly invokes /collector-dev:task, ensuring the skill's
allowed-tools restrictions are enforced. Only difference is headless
skips PR creation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Validate before launching the container:
- Docker running and image exists (with build command hint)
- gcloud ADC credentials file exists
- Vertex AI env vars set (CLAUDE_CODE_USE_VERTEX, GOOGLE_CLOUD_PROJECT,
  GOOGLE_CLOUD_LOCATION)
- gh CLI authenticated (only for PR mode)
- ~/.gitconfig and ~/.ssh exist (warnings)
- git push and gh pr create errors are no longer silent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove gh from run.sh entirely (no check_gh, no setup_pr)
- Remove --headless (was identical to default mode without PR)
- task skill now has create_pull_request and create_branch in allowed-tools
- Agent pushes branch and creates draft PR via GitHub MCP server
- iterate skill stays read-only on GitHub (only task can create PRs)
- Simplified to 4 modes: default task, --interactive, --local, --shell

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move skills from .claude/plugins/collector-dev/ to .claude/skills/
  (standalone skills, no plugin wrapper). Fixes skills not loading in
  worktrees since the plugin directory was never committed.
- Delete collector-dev plugin entirely (caused phantom GitHub MCP)
- Remove --plugin-dir from run.sh
- Add entrypoint.sh that creates .claude dirs and registers GitHub
  MCP server via claude mcp add-json when GITHUB_TOKEN is set
- Add --skip-submodules and --debug flags to run.sh
- Add COPY --chmod=755 for entrypoint.sh in Dockerfile
- Simplify CLAUDE.md from 249 to 30 lines — just build commands,
  key paths, testing rules, and conventions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…t issues

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The git push deny was blocking the host too. Move it to the
entrypoint which writes /home/dev/.claude/settings.json (user scope)
inside the container only. Project-level settings.json keeps only
the MCP deny rules which apply everywhere.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
No SSH keys in container = git push fails at auth. No deny rule needed.
GitHub MCP (PAT via GITHUB_TOKEN) is the only push path.
Also removes git push deny from entrypoint settings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
git clone --local sets origin to the local filesystem path. Fix the
remote to the real GitHub URL so git push works from the clone.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@robbycochran robbycochran changed the base branch from master to rc-claude-dev March 19, 2026 06:16
@robbycochran robbycochran deleted the claude/agent-1773900399-24020 branch March 19, 2026 06:19
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 27.38%. Comparing base (ec207af) to head (1ec9963).
⚠️ Report is 23 commits behind head on rc-claude-dev.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@              Coverage Diff               @@
##           rc-claude-dev    #3117   +/-   ##
==============================================
  Coverage          27.38%   27.38%           
==============================================
  Files                 95       95           
  Lines               5427     5427           
  Branches            2548     2548           
==============================================
  Hits                1486     1486           
  Misses              3214     3214           
  Partials             727      727           
Flag Coverage Δ
collector-unit-tests 27.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

2 participants