Skip to content

refactor(agents): unify exec approval decisions - #125503

Merged
steipete merged 2 commits into
mainfrom
steipete/exec-host-approval-lifecycle
Aug 18, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/exec-host-approval-lifecycle

Conversation

@steipete

@steipete steipete commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway-hosted and node-hosted exec approvals independently combined explicit decisions, timeout fallback policy, and strict human-only review rules. The duplicated orchestration made approval behavior easier to drift as either host evolved.

Why This Change Was Made

This introduces one shared approval-decision owner that resolves explicit approval, current timeout fallback, and strict human-review boundaries. Gateway and node hosts retain their own policy refresh, security events, mutable-file checks, dispatch, and follow-up delivery; only the duplicated decision state machine moves into the shared owner. A no-op argument-copy helper and the old exported low-level decision helpers are removed.

User Impact

No intended user-visible behavior change. Gateway and node exec approvals now apply the same decision ordering by construction, reducing the chance that timeout fallback or strict inline-eval/auto-review behavior diverges between hosts.

Production LOC: +138 / -144 (net -6). Tests: +154 / -68.

AI-assisted: yes. I understand and reviewed the resulting approval ownership boundary.

Evidence

  • node scripts/run-vitest.mjs src/agents/bash-tools.exec-host-shared.test.ts src/agents/bash-tools.exec-host-gateway.test.ts src/agents/bash-tools.exec-host-node.test.ts — 204 tests passed on the rebased head.
  • node scripts/check-changed.mjs — passed, including core/test typechecks, lint, dead-export scans, import-cycle checks, and auth/storage guards.
  • pnpm tsgo and pnpm tsgo:core:test — passed.
  • pnpm docs:check-links — 6,520 internal links checked, 0 broken.
  • Autoreview — clean, no accepted/actionable findings, including the runner-plan milestone update.
  • The shared tests cover fail-closed timeout denial, explicit approval across strict boundaries, and current timeout policy followed by human-only enforcement. Existing gateway/node suites retain no-route, timeout fallback, auto-review, headless denial, and asynchronous follow-up coverage.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Aug 18, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 18, 2026
@steipete
steipete marked this pull request as ready for review August 18, 2026 01:55
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. 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. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 10:01 PM ET / August 18, 2026, 02:01 UTC.

ClawSweeper review

What this changes

The PR moves Gateway and node exec approval decision ordering into one shared resolver and removes the prior duplicated low-level helpers.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No discrete defect was identified in the available PR-head code and supplied diff: both hosts now use the same timeout and strict-approval ordering. This maintainer-labeled exec-authorization refactor should remain open for owner review and exact-head CI completion; the local checkout cannot supply a current-main merge comparison.

Priority: P2
Reviewed head: 65411b4d15c259ce7ff1684836d6503a920eb587

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The refactor is coherent and covered at the shared decision boundary, with final confidence limited by unavailable current-main comparison and unfinished exact-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, non-user-visible refactor has focused test evidence in its PR body; no separate contributor real-behavior proof gate applies.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, non-user-visible refactor has focused test evidence in its PR body; no separate contributor real-behavior proof gate applies.
Evidence reviewed 6 items Shared decision owner: The new resolver applies the base decision, host timeout callback, then strict human-only boundary in one sequence.
Gateway integration: Both the unavailable-inline and awaited Gateway approval paths call the shared resolver while retaining Gateway-specific allowlist fallback and mutable-file validation.
Node integration: Both node approval paths call the shared resolver, retain current-policy fallback lookup, and revalidate policy before invoking the node.
Findings None None.
Security None None.

How this fits together

Gateway and node exec hosts create or await command approvals, then decide whether a command may run. The shared resolver combines an explicit decision, timeout fallback, and human-only requirements before each host performs its own dispatch and follow-up handling.

flowchart LR
  A[Command execution request] --> B[Gateway or node exec host]
  B --> C[Approval request and policy refresh]
  C --> D[Shared approval decision]
  D --> E{Approved?}
  E -->|Yes| F[Dispatch command]
  E -->|No| G[Return denial or follow-up]
Loading

Before merge

  • Resolve merge risk (P1) - This changes the authorization boundary for command execution; exact-head CI should complete before merge.
  • Resolve merge risk (P1) - The local repository cannot compare the PR to the supplied current-main SHA because required parent objects are unavailable, so base-only regressions remain unverified.
  • Complete next step (P2) - The protected maintainer label and unavailable current-main comparison make this an owner-review item rather than a safe automated repair candidate.
Agent review details

Security

None.

PR surface

Source -6, Tests +86, Docs 0. Total +80 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 138 144 -6
Tests 3 154 68 +86
Docs 1 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 294 214 +80

Review metrics

Metric Value Why it matters
Production versus test delta production +138/-144 (net -6); tests +154/-68 (net +86) The refactor reduces production code while adding focused coverage around the unified approval ordering.

Merge-risk options

Maintainer options:

  1. Complete exact-head authorization checks (recommended)
    Wait for the PR head’s focused Gateway/node approval tests and required CI to finish before merging this command-authorization refactor.
  2. Accept the reviewed refactor scope
    An owner may merge once exact-head checks are green, accepting the normal risk of centralizing a security decision path.

Technical review

Best possible solution:

Keep one canonical approval resolver, retain host-specific policy refresh and dispatch checks, and merge only after an owner confirms the exact-head validation result.

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

Not applicable: this is a behavior-neutral refactor review, and the relevant approval ordering is source-traceable through the shared resolver and both host call sites.

Is this the best way to solve the issue?

Yes, provisionally: centralizing the duplicated decision state machine preserves host-specific policy and dispatch ownership; current-main comparison remains unavailable locally.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 26353983f36e.

Labels

Label changes:

  • add P2: The change affects command approval behavior across Gateway and node hosts, but no current user-facing regression was identified.
  • add merge-risk: 🚨 security-boundary: Merging changes shared authorization ordering for command execution, so both host paths require exact-head verification.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, non-user-visible refactor has focused test evidence in its PR body; no separate contributor real-behavior proof gate applies.

Label justifications:

  • P2: The change affects command approval behavior across Gateway and node hosts, but no current user-facing regression was identified.
  • merge-risk: 🚨 security-boundary: Merging changes shared authorization ordering for command execution, so both host paths require exact-head verification.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, non-user-visible refactor has focused test evidence in its PR body; no separate contributor real-behavior proof gate applies.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: The checked-out head and available blame attribute the shared decision owner and both host integrations to this refactor; older history is unavailable in the checkout. (role: current approval-refactor author and recorded source owner; confidence: medium; commits: 65411b4d15c2; files: src/agents/bash-tools.exec-host-shared.ts, src/agents/bash-tools.exec-host-gateway.ts, src/agents/bash-tools.exec-host-node.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the exact-head CI run complete before merge.

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.

@steipete
steipete merged commit b485f0c into main Aug 18, 2026
283 of 284 checks passed
@steipete
steipete deleted the steipete/exec-host-approval-lifecycle branch August 18, 2026 02:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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