Skip to content

fix(core): honor host authority across approved resumes - #200

Merged
steipete merged 4 commits into
mainfrom
codex/claw-1093-resume-host-authority
Oct 7, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/claw-1093-resume-host-authority

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Approved resumes can outlive the host invocation that authorized them while awaiting state reads, locks, or checkpoint publication. Add the optional synchronous ctx.assertInvocationCurrent callback to the core tool API and recheck it at built-in process, network, state, and workflow-shell effect boundaries. CLI behavior stays unchanged when the callback is absent.

Retirement before unsafe dispatch restores caller-owned approval/input claims and the original short approval ID without overwriting a competing mapping. Partial successors are discarded. Once unsafe dispatch starts, the checkpoint stays consumed to prevent replay; entering an unsafe pipeline command remains a conservative boundary even if a later effect-site check stops its I/O. Custom commands and injected adapters must cooperate with the callback, and the SDK does not expose this contract. The README documents these boundaries.

The compiled main baseline reproduced a retired host still executing a resumed command. The regression suite covers awaited preparation, locks, atomic publication, successor handoff, terminal cleanup, workflow loops/parallel branches, and real loopback HTTP through runToolRequest/resumeToolRequest: current dispatch 1; retired-before-I/O 0; byte-identical safe checkpoint restored; recovered dispatch 1; dispatched-before-retirement 1; replay 0. This is synthetic loopback transport proof, not a live Gateway test; the related integration is openclaw/openclaw#163307.

Validation: AWS Crabbox frozen install, build, CLI doctor, typecheck, lint, and all 726 tests passed without skips. Independent Codex P0–P2 reviews found no actionable defects. GitHub CI checks Node 22/24 and workflow syntax. Thanks @Patrick-Erichsen; the original implementation and test commits are preserved in the branch, and the Unreleased changelog records the fix.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

🦞👀
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.

@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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed October 6, 2026, 4:46 PM ET / 20:46 UTC (Revision 6).

ClawSweeper review

What this changes

Lobster rechecks host authority before resumed process, network, and state effects and restores safe approval checkpoints when an invocation retires.

Merge readiness

⛔ Needs changes before merge - 1 item remains

The change remains necessary: current main lacks these host-authority checks. The production-path proof supports rejection, safe recovery, and replay prevention, and no actionable patch defect was found. The PR remains a draft.

Priority: P2
Reviewed head: b1f28baabbe0784e2ba0ac6d532f5c3f574eab0d

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong production-path authority proof and focused rollback coverage support an above-average patch; draft status does not reduce its quality rating.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Reported after-fix execution at the pinned head uses Lobster's production run/resume owners and real HTTP fetch against a loopback server: allowed dispatch succeeds, retirement before I/O sends nothing and restores the checkpoint, recovery succeeds, and completed dispatch cannot replay. Supplemental filesystem/process scenarios cover rollback windows. Stored formats remain unchanged, and byte-identical restoration plus approval-ID recovery verifies the affected existing-state compatibility.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Reported after-fix execution at the pinned head uses Lobster's production run/resume owners and real HTTP fetch against a loopback server: allowed dispatch succeeds, retirement before I/O sends nothing and restores the checkpoint, recovery succeeds, and completed dispatch cannot replay. Supplemental filesystem/process scenarios cover rollback windows. Stored formats remain unchanged, and byte-identical restoration plus approval-ID recovery verifies the affected existing-state compatibility.
Evidence reviewed 9 items Repository policy: Read the full root AGENTS.md. Its approval and resume guidance informed the review; no nested AGENTS.md or maintainer-notes policy was found.
Introduced changes and current-main necessity: Inspected the pinned main-to-head production diff. Main has cancellation and consumed-checkpoint machinery but lacks the optional host-authority predicate and the added effect-boundary checks. The branch adds those checks without requiring a predicate from existing callers.
Authority at final HTTP dispatch: The built-in tool invocation checks current authority immediately before its non-retryable dispatch marker and fetch. Process spawning and atomic state publication receive equivalent checks; workflow retries cannot continue after the predicate rejects.
Findings None None.
Security None None.

How this fits together

Lobster runs typed pipelines and workflow files for CLI and embedded hosts. Approval resumes load saved checkpoints, then either dispatch permitted effects, publish another gate, or finish the workflow.

flowchart TD
  A[Host resume request] --> B[Saved approval checkpoint]
  B --> C[Claim checkpoint]
  C --> D[Check current host authority]
  D --> E[Process network or state effect]
  D --> F[Restore safe checkpoint]
  E --> G[Finish or publish next gate]
  F --> H[Retry through current host]
Loading

Before merge

  • Complete next step (P2) - Mark this draft PR ready for review before landing.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test LOC production +459/-89 (net +370); tests +1295/-0 Production growth implements effect-boundary guards and rollback handling, with substantially larger coverage for retirement windows.

Technical review

Best possible solution:

Retain optional host checks at built-in effect boundaries, restore only safe caller-owned checkpoints, and preserve non-replayability after dispatch.

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

Yes, source establishes the gap: main cannot recheck a host predicate after awaited resume preparation or before built-in effects. The contributor's gated production-path scenario exercises these retirement windows; this review did not execute it.

Is this the best way to solve the issue?

Yes. An optional host callback extends the existing cancellation and checkpoint machinery while retaining callers that supply no predicate, and claim-specific rollback avoids restoring an already-dispatched approval.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is bounded embedded-host resume hardening with demonstrated recovery behavior and no evidence of a current emergency.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Reported after-fix execution at the pinned head uses Lobster's production run/resume owners and real HTTP fetch against a loopback server: allowed dispatch succeeds, retirement before I/O sends nothing and restores the checkpoint, recovery succeeds, and completed dispatch cannot replay. Supplemental filesystem/process scenarios cover rollback windows. Stored formats remain unchanged, and byte-identical restoration plus approval-ID recovery verifies the affected existing-state compatibility.
  • proof: sufficient: Contributor real behavior proof is sufficient. Reported after-fix execution at the pinned head uses Lobster's production run/resume owners and real HTTP fetch against a loopback server: allowed dispatch succeeds, retirement before I/O sends nothing and restores the checkpoint, recovery succeeds, and completed dispatch cannot replay. Supplemental filesystem/process scenarios cover rollback windows. Stored formats remain unchanged, and byte-identical restoration plus approval-ID recovery verifies the affected existing-state compatibility.

Evidence

What I checked:

  • Repository policy: Read the full root AGENTS.md. Its approval and resume guidance informed the review; no nested AGENTS.md or maintainer-notes policy was found. (AGENTS.md:1, b1f28baabbe0)
  • Introduced changes and current-main necessity: Inspected the pinned main-to-head production diff. Main has cancellation and consumed-checkpoint machinery but lacks the optional host-authority predicate and the added effect-boundary checks. The branch adds those checks without requiring a predicate from existing callers. (src/core/tool_runtime.ts:37, b1f28baabbe0)
  • Authority at final HTTP dispatch: The built-in tool invocation checks current authority immediately before its non-retryable dispatch marker and fetch. Process spawning and atomic state publication receive equivalent checks; workflow retries cannot continue after the predicate rejects. (src/commands/stdlib/openclaw_invoke.ts:95, b1f28baabbe0)
  • Real transport proof: The captured PR body and contributor comment report the compiled loopback HTTP scenario passing at this head: current=1 request, retired-before-I/O=0, byte-identical checkpoint restored, approval-ID recovery=1, completed dispatch=1, replay=0. Inspected the scenario: it uses production runToolRequest/resumeToolRequest, the built-in openclaw.invoke command, real fetch, and an actual HTTP server; filesystem gates inject retirement without replacing the transport. Comment: fix(core): honor host authority across approved resumes #200 (comment). No reviewer-side execution was performed. (test/core_host_authority.test.ts:492, b1f28baabbe0)
  • Checkpoint compatibility and rollback ownership: Persisted checkpoint, consumed-marker, token, and approval-index formats remain unchanged. Restoration checks the exact caller-owned claim; short-ID restoration uses exclusive publication and does not overwrite a competing mapping. The reported real-transport run verifies byte-identical restoration and successful existing-ID recovery; supplemental pipeline/workflow cases cover successor publication and safe terminal deletion. (src/state/store.ts:513, b1f28baabbe0)
  • Live draft state and review continuity: GitHub confirms the exact reviewed head remains open, unmerged, and draft. The previous completed review at the same SHA had no findings or published rank-up moves; its draft-readiness action remains applicable. (b1f28baabbe0)

Likely related people:

  • zhangguiping-xydt: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • KrasimirKralev: 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 (5 earlier review cycles)
  • reviewed 2026-10-02T07:58:24.029Z sha f1b523f :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-02T11:17:10.437Z sha b1f28ba :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T23:53:40.484Z sha b1f28ba :: needs changes before merge. :: none
  • reviewed 2026-10-05T05:38:54.496Z sha b1f28ba :: needs changes before merge. :: none
  • reviewed 2026-10-06T18:33:40.399Z sha b1f28ba :: needs changes before merge. :: none

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Real loopback HTTP authority proof is now on this PR at b1f28ba: current=1 request, retired-before-I/O=0 with byte-identical checkpoint restored, approval-ID recovery=1, dispatched-before-retirement=1, replay=0. pnpm lint, pnpm build, and pnpm test (723 passed, 3 skipped) pass; the full diagnostic is in the PR body. @clawsweeper re-review

@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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 Oct 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 5, 2026
@steipete
steipete marked this pull request as ready for review October 7, 2026 07:12
@steipete
steipete force-pushed the codex/claw-1093-resume-host-authority branch from b1f28ba to 325717a Compare October 7, 2026 07:12
@chatgpt-codex-connector

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

Copy link
Copy Markdown

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-07T07:17:17.229942Z 325717a Draft marked ready
ℹ️ 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.

@steipete
steipete merged commit 955cc0b into main Oct 7, 2026
7 of 8 checks passed
@steipete
steipete deleted the codex/claw-1093-resume-host-authority branch October 7, 2026 07:15

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 325717a693

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/runtime.ts
Comment on lines +158 to +159
assertInvocationCurrent?.();
if (command.meta?.resumeSafeBeforeInput !== true) onUnsafeCommandDispatch?.();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recheck authority after state-read lock waits

For an approved pipeline ending in state.get, this check runs before stateGetCommand waits in readRememberedState's file lock. If the host retires the invocation while that lock is contended, the command still performs the read and returns successfully after the lock is released; line 159 has already classified the stage as unsafe, so terminal finalization consumes the approval without another authority check. Recheck assertInvocationCurrent inside the locked read task (or immediately after the wait) so a retired invocation cannot complete this built-in state effect.

Useful? React with 👍 / 👎.

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: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants