Skip to content

feat(sandbox): label worker-owned containers - #55

Merged
steipete merged 1 commit into
mainfrom
jesse/endor-local-scanner
Sep 22, 2026
Merged

steipete merged 1 commit into
mainfrom
jesse/endor-local-scanner

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Supervisors can set CLAWSCAN_SANDBOX_RUN_ID to identify Docker containers belonging to a terminated scan and clean them up without touching unrelated work. Each container gets the supplied run ID and a random command ID; ordinary runs retain their existing docker run --rm behavior. Cleanup remains the supervisor’s responsibility.

The implementation validates run IDs, does not implicitly forward the ID into the container environment, and documents the ownership contract. The nearby duplicate mount-comparison helper now uses Go’s equivalent slices.Equal.

Contributor proof: the same real worker deadline left one container before this change and zero afterward; an unrelated container survived. Regression tests cover ordinary runs, invalid IDs, unique command IDs, and environment isolation.

Validation on Go 1.27.1/Linux: go test -count=1 ./..., go vet ./..., make docs-site, and the built-in static scanner CLI smoke test all passed on AWS Crabbox. Independent Codex review is clean through P2. GitHub checks must pass on the exact PR head before merge.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 1:55 AM ET / 05:55 UTC (Revision 11).

ClawSweeper review

What this changes

Adds optional Docker container labels so supervising workers can identify containers belonging to a scan, with CLI help, documentation, and focused tests.

Merge readiness

✅ Ready for maintainer review

Keep open: the capability is absent from current main and the latest release, and no blocking defect was found. The previous draft-state blocker is resolved.

Priority: P2
Reviewed head: 41d779ab8da2a78669a162285279c675de8b34f9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with relevant real-worker observations, targeted tests, and no remaining actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body reports the real worker exercising the changed Docker runner at this head: cancellation left zero scan containers, Docker events confirmed destruction, and an unrelated container survived. No stored application-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body reports the real worker exercising the changed Docker runner at this head: cancellation left zero scan containers, Docker events confirmed destruction, and an unrelated container survived. No stored application-data contract changes.
Evidence reviewed 8 items Introduced scope and ownership: The pinned merge-base-to-head diff contains 80 additions across five files: 18 production/help lines, 52 test lines, and 10 documentation lines. It adds labels without introducing container deletion, scanner adapters, dependencies, or workflow changes.
Current-main necessity: Current main's Docker runner still constructs docker run --rm without run or command labels. A tree-wide search found no equivalent ownership-label implementation.
Release check: The supplied v0.1.8 release revision also uses unlabeled docker run --rm. GitHub confirms v0.1.8 was published September 10, 2026; the requested capability is not established in that release.
Findings None None.
Security None None.

How this fits together

ClawScan runs command-backed scanners and judges through a shared Docker runner. The new labels connect those containers to a supervising worker's scan run; the worker remains responsible for cleanup after cancellation.

flowchart TD
  A[Supervising worker] --> B[ClawScan process]
  B --> C[Docker command runner]
  C --> D{Run ID supplied?}
  D -->|Yes| E[Validate ID and attach labels]
  D -->|No| F[Ordinary Docker container]
  E --> G[Labeled Docker container]
  G --> H[Worker selects and cleans up]
  A --> H
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth Production/help +18, tests +52, docs +10; no deletions The small production addition is justified by worker-specific container identification and has focused coverage.

Technical review

Best possible solution:

Keep container identification opt-in and generic, with cancellation cleanup owned by the supervising worker.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a feature request; source confirms existing containers lack ownership labels, and the body reports a real before/after worker-cancellation run.

Is this the best way to solve the issue?

Yes: adding labels at the shared Docker runner is a narrow solution that supports scanners and judges while preserving existing execution and cleanup behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ca811e0e73ce.

Labels

Label justifications:

  • P2: This is a bounded operational improvement for supervisors that cancel Docker-backed scans.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body reports the real worker exercising the changed Docker runner at this head: cancellation left zero scan containers, Docker events confirmed destruction, and an unrelated container survived. No stored application-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports the real worker exercising the changed Docker runner at this head: cancellation left zero scan containers, Docker events confirmed destruction, and an unrelated container survived. No stored application-data contract changes.

Evidence

What I checked:

  • Introduced scope and ownership: The pinned merge-base-to-head diff contains 80 additions across five files: 18 production/help lines, 52 test lines, and 10 documentation lines. It adds labels without introducing container deletion, scanner adapters, dependencies, or workflow changes. (internal/runner/sandbox.go:209, 41d779ab8da2)
  • Current-main necessity: Current main's Docker runner still constructs docker run --rm without run or command labels. A tree-wide search found no equivalent ownership-label implementation. (internal/runner/sandbox.go:199, ca811e0e73ce)
  • Release check: The supplied v0.1.8 release revision also uses unlabeled docker run --rm. GitHub confirms v0.1.8 was published September 10, 2026; the requested capability is not established in that release. (internal/runner/sandbox.go:199, 6190d96d7fc4)
  • Production behavior proof: The fully supplied PR body at captured sourceRevision ecf4bc12e81685b72f0495a24b26d154c868b9cd43d0971a121f2dc04e58bdc9 reports the actual ClawHub worker exercising a custom scanner with a three-second deadline: one container remained before, zero after at the reviewed head, completion took 3.61 seconds, Docker events showed destruction, and an unrelated container survived. This directly exercises the labels' intended consumer; the observations are contributor-reported, not independently rerun. (41d779ab8da2)
  • Compatibility and security boundary: Labels are opt-in, validated before Docker execution, and passed as separate arguments. Existing mount permissions, environment allowlisting, timeout handling, and --rm behavior remain intact. The patch neither grants Docker access nor performs cleanup; the documented supervisor already owns that operation. Tests cover ordinary runs, invalid IDs, unique command IDs, and absence of automatic run-ID environment passthrough. (internal/runner/sandbox_test.go:8, 41d779ab8da2)
  • Review continuity: The previous completed review examined this exact head, reported no findings, and requested ready-for-review status. The supplied timeline records that transition at 2026-09-22T05:51:31Z. The earlier Endor-preflight finding no longer applies because the current introduced diff contains no Endor adapter. (41d779ab8da2)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Patrick-Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-16T06:56:45.680Z sha 8da3f95 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-21T06:12:58.020Z sha 3026ed5 :: needs changes before merge. :: none
  • reviewed 2026-09-21T06:19:47.835Z sha 3026ed5 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T04:12:27.507Z sha e694188 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T04:26:56.854Z sha e694188 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T04:33:09.506Z sha e694188 :: blocked before merge. :: none
  • reviewed 2026-09-22T05:41:41.430Z sha 41d779a :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T05:47:10.225Z sha 41d779a :: needs changes before merge. :: none

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Sep 21, 2026
@jesse-merhi
jesse-merhi marked this pull request as ready for review September 21, 2026 06:16
Copilot AI lite review requested due to automatic review settings September 21, 2026 06:16
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@jesse-merhi jesse-merhi changed the title feat(scanners): add Endor dependency reachability analysis fix(sandbox): clean up containers after interrupted scans Sep 22, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 22, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@jesse-merhi
jesse-merhi marked this pull request as draft September 22, 2026 04:28
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 22, 2026
@jesse-merhi jesse-merhi changed the title fix(sandbox): clean up containers after interrupted scans feat(sandbox): label worker-owned containers Sep 22, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 22, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@jesse-merhi
jesse-merhi marked this pull request as ready for review September 22, 2026 05:51
Allow supervising workers to identify and clean up their own scan containers after cancellation. Preserve unsupervised behavior and keep deletion ownership with the supervisor. Replace redundant mount slice comparison with slices.Equal.

Co-authored-by: Jesse Merhi <79823012+jesse-merhi@users.noreply.github.com>
@steipete
steipete force-pushed the jesse/endor-local-scanner branch from 41d779a to 556dc83 Compare September 22, 2026 09:25
@steipete
steipete merged commit b9277ca into main Sep 22, 2026
9 of 10 checks passed
@vincentkoc
vincentkoc deleted the jesse/endor-local-scanner branch September 25, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants