Skip to content

fix: hide sandbox-only github_publish actions from direct sessions - #178671

Merged
steipete merged 2 commits into
mainfrom
fix/github-publish-sandbox-only-actions
Oct 20, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/github-publish-sandbox-only-actions

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: agents running without a sandbox are offered github_publish actions refresh_base and upload_evidence, which only work inside a sandbox, so calling them fails with a refusal that reads like the session's sandbox is broken.

User Impact

Direct (non-sandboxed) sessions no longer see refresh_base or upload_evidence. They keep publish, edit, ready, request_review and the operator actions unchanged. Sandboxed sessions are unaffected: refresh_base still appears for a writable managed-worktree sandbox, and upload_evidence still appears whenever the sandbox can read files with source provenance.

Why This Change Was Made

Both actions arrived with #174532 (refresh_base) and #176139 (upload_evidence). They are advertised to every session that can publish, but the Gateway accepts them only from a capable sandbox. In a real run with sandbox mode off, an agent hit that refusal ("Run refresh_base from this workspace's sandboxed agent ..."). It concluded the session had lost its sandbox and stopped a PR landing instead of merging the base with git, which is exactly what a direct session should do.

One predicate per action now lives in src/agents/sandbox/github-publication.ts. The same predicate decides tool visibility (schema enum, action-specific properties and description bullets) and Gateway enforcement, so the two can no longer drift apart. The Gateway refusals stay in place for non-tool callers and now say what to do instead. The sandbox context is a session/config fact, so the tool definition stays stable within a session.

Evidence

  • New table-driven construction test in src/agents/tools/github-publish-tool.test.ts covering direct, writable managed, read-only managed, unmanaged, missing-backend, missing-file-bridge, missing source-aware read and disabled sandboxes, with and without operator actions. It failed on the base (6 failed: e.g. direct session refresh_base: expected true to be false) and passes with the fix (23/23).
  • Consumer tests updated and passing: openclaw-tools.registration, github-publication-evidence, github-publication-base-refresh-actions, github-publication-workflows; prompt-prefix contract agent-tools.prefix-stability passes.
  • pnpm tsgo:core and pnpm tsgo:core:test for the changed paths pass. The core test shard root budget (advisory under GitHub Actions) already exceeds 720 roots on main; this change adds no test files.
  • pnpm format:check and git diff --check pass on the changed files. Local oxlint could not load eslint-plugin-solid in this source-only worktree; CI lint covers it.
  • Independent Codex autoreview (P1 scope): scoped-clean.

refresh_base and upload_evidence only work from a capable sandbox, but github_publish offered them to every publishing session. A direct session that called refresh_base got a refusal that read like a lost sandbox and stopped instead of merging the base with git.

One predicate per action now decides both tool visibility and Gateway enforcement, and the refusals name the next step.
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T18:53:22.897245Z 848b8e5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: a17a630b8367797e9d02c3a1a21efa22d45c8888
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox/github-publication.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime docker Docker and sandbox tooling agents Agent runtime and tooling size: M labels Oct 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Hide sandbox-only GitHub publication actions from sessions that cannot execute them, using shared capability checks.

Example: An agent with sandbox mode off needs to update its PR branch from main.

  • Before: github_publish advertises refresh_base, but the Gateway refuses it with guidance implying a missing sandbox.
  • After: refresh_base and upload_evidence are absent from the tool schema and instructions; direct refresh requests explain using git in the workspace.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, coherent repair with useful schema and handler coverage; runtime confidence is limited to supplied harness validation.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR does not materially change authority and is outside the contributor proof gate; supplied validation covers construction and registered handlers, while inspected linked screenshots demonstrate the earlier sandbox-refresh feature rather than this visibility fix.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A direct-session agent selects a sandbox-only action, receives misleading recovery guidance and can abandon authorized PR work.
Reason: The maintainer-authored direction restores accurate capability discovery without removing an operation that direct sessions could successfully perform.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a verified mismatch between advertised tools and supported sandbox capabilities, with no concrete introduced defect found.

Priority: P2
Reviewed head: 848b8e5257fe820ccf65d9c6def8052d95a3a7e0

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No fresh shipped-agent demonstration shows direct-session action omission alongside retained capable-sandbox actions.
Agent review details

How this fits together

Agent tool construction consumes the prepared sandbox context and exposes publication actions; Gateway handlers enforce workspace eligibility and current authorization before filesystem or GitHub effects.

flowchart TD
  A[Prepared sandbox context] --> B[Shared capability predicates]
  B --> C[Publication tool schema]
  C --> D[Agent action]
  D --> E[Gateway publication handlers]
  B --> E
  E --> F[Workspace and GitHub operations]
Loading

Technical review

Best possible solution:

Use the shared sandbox predicates to keep publication schemas, instructions and Gateway eligibility aligned.

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

Current-main source shows both actions advertised without sandbox eligibility and rejected by their Gateway owners; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The smallest complete fix is to share the existing eligibility conditions between discovery and enforcement; every introduced production hunk serves that invariant.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Managed sandbox base refresh keeps the original intent (23173ed: Provide private managed sandbox workspaces a credential-free route to integrate their selected repository base.)
  • Sandbox evidence upload keeps the original intent (f663437: Upload inspected workspace media through the current session's authorized publisher without exposing credentials or unrelated files.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit f663437 adds src/gateway/github-publication-evidence.ts:53 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f66343777a05; files: src/gateway/github-publication-evidence.ts)

PR surface

Source +32, Tests +109, Docs +7. Total +148 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 55 23 +32
Tests 4 117 8 +109
Docs 3 12 5 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 184 36 +148

Labels

Label changes:

  • add P2: Unsupported advertised actions can derail an agent's PR workflow, but ordinary Git and supported publication actions remain available.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Unsupported advertised actions can derail an agent's PR workflow, but ordinary Git and supported publication actions remain available.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 20, 2026, 3:02 PM ET / 19:02 UTC.

@steipete
steipete enabled auto-merge (squash) October 20, 2026 20:09
@steipete
steipete merged commit 503ae08 into main Oct 20, 2026
116 checks passed
@steipete
steipete deleted the fix/github-publish-sandbox-only-actions branch October 20, 2026 20:11
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…penclaw#178671)

refresh_base and upload_evidence only work from a capable sandbox, but github_publish offered them to every publishing session. A direct session that called refresh_base got a refusal that read like a lost sandbox and stopped instead of merging the base with git.

One predicate per action now decides both tool visibility and Gateway enforcement, and the refusals name the next step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: M 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.

1 participant