Skip to content

Execute basis-bound workspace patches - #712

Merged
flyingrobots merged 14 commits into
mainfrom
task/711-basis-bound-workspace-patches
Jul 30, 2026
Merged

Execute basis-bound workspace patches#712
flyingrobots merged 14 commits into
mainfrom
task/711-basis-bound-workspace-patches

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Admit, execute, settle, reconcile, recover, and replay compiler-authored validated workspace patches through an exact capability-rooted aperture.

Closes #711.

Summary by CodeRabbit

  • New Features

    • Added a validated single-file workspace patch capability.
    • Supports basis- and path-bound replacements with atomic updates.
    • Records before-and-after file identities and settlement evidence.
  • Bug Fixes

    • Rejects stale files, unauthorized or unsafe paths, symlinks, special files, and oversized replacements.
    • Prevents duplicate changes during retries or replay; ambiguous results are reported without reapplying changes.
  • Documentation

    • Updated external-action guidance, architecture notes, and changelog with patch behavior, safety rules, and recovery procedures.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@flyingrobots

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@flyingrobots

Copy link
Copy Markdown
Owner Author

@codex please review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@flyingrobots, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 21 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cd9edc2f-172b-4f20-a82d-1e287f049e59

📥 Commits

Reviewing files that changed from the base of the PR and between 8318444 and ce21333.

📒 Files selected for processing (7)
  • .ban-nondeterminism-allowlist
  • CHANGELOG.md
  • crates/warp-core/src/external_action_adapter.rs
  • crates/warp-core/src/validated_workspace_patch.rs
  • crates/warp-core/tests/bounded_workspace_patch_tests.rs
  • crates/warp-core/tests/fixtures/external_action_patch/SOURCE.md
  • docs/topics/ExternalActions.md
📝 Walkthrough

Walkthrough

Echo now consumes independently verified Edict patch requests through a capability-rooted adapter that validates paths, bases, identities, budgets, and filesystem types before atomic replacement. It durably settles outcomes and reconciles retries by observing postconditions without reapplying writes.

Changes

Validated workspace patch execution

Layer / File(s) Summary
External-action admission contracts
crates/warp-core/src/external_action_adapter.rs, crates/warp-core/src/lib.rs
Admission supports request-only and compatibility profiles with profile-specific settlement-byte minimums, and exposes the non-wasm patch module.
Patch validation and atomic replacement
crates/warp-core/src/validated_workspace_patch.rs
The adapter decodes canonical input, enforces capability-rooted path and filesystem policies, checks bases and budgets, and performs no-follow atomic replacement with postcondition verification.
Settlement candidate construction and admission
crates/warp-core/src/validated_workspace_patch.rs
Success, rejection, and outcome-unknown candidates encode validated evidence and enter the WAL-backed coordinator only after grant, schema, posture, identity, and budget checks.
Postcondition-only reconciliation
crates/warp-core/src/validated_workspace_patch.rs
The reconciler observes the target file and settles success only when the expected replacement and resulting identities are present; otherwise it returns outcome unknown.
End-to-end validation
crates/warp-core/tests/bounded_workspace_patch_tests.rs, crates/warp-core/tests/fixtures/external_action_patch/*
Tests cover durable ordering, refusal paths, budgets, replay, reconciliation, binary replacements, stress cases, and compiler-owned CBOR fixtures.
Protocol and project documentation
CHANGELOG.md, README.md, docs/adr/0026-durable-external-action-settlement.md, docs/topics/ExternalActions.md
Documentation describes the adapter profile, execution ordering, settlement evidence, rejection behavior, and replay rules.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Edict
  participant ExternalActionCoordinatorV1
  participant ValidatedWorkspacePatchAdapterV1
  participant WorkspaceFilesystem
  Edict->>ExternalActionCoordinatorV1: submit admitted patch request
  ExternalActionCoordinatorV1->>ValidatedWorkspacePatchAdapterV1: provide claim grant
  ValidatedWorkspacePatchAdapterV1->>WorkspaceFilesystem: validate basis and replace target atomically
  WorkspaceFilesystem-->>ValidatedWorkspacePatchAdapterV1: resulting basis and content identities
  ValidatedWorkspacePatchAdapterV1->>ExternalActionCoordinatorV1: admit terminal settlement
  ExternalActionCoordinatorV1-->>Edict: durable settlement
Loading

Possibly related issues

  • flyingrobots/hello-echo#11 — The patch adapter and durable settlement flow implement the described downstream Echo integration.
  • flyingrobots/edict#178 — The runtime adapter consumes the compiler-generated and verified patch request representation described by this issue.

Possibly related PRs

  • flyingrobots/echo#704 — Provides the durable external-action request, claim, settlement, and WAL lifecycle extended by this adapter.
  • flyingrobots/echo#706 — Shares the compiler-edict admission path whose operation-profile and settlement-byte handling are updated here.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: executing basis-bound workspace patches.
Linked Issues check ✅ Passed The implementation adds a validated workspace patch adapter, reconciliation, restart coverage, and tests that align with the listed acceptance criteria.
Out of Scope Changes check ✅ Passed The changes are concentrated on workspace patch execution, documentation, fixtures, and tests, with no obvious unrelated feature work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/711-basis-bound-workspace-patches

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/warp-core/src/external_action_adapter.rs`:
- Line 52: The request-only settlement floor lacks an enforced relationship with
the canonical pathless obstruction settlement encoding. Add a test near the
external-action adapter logic that builds the worst-case pathless obstruction
settlement through validated_workspace_patch::build_candidate and asserts its
encoded size is at most MIN_REQUEST_ONLY_SETTLEMENT_BYTES_V1; add a concise
comment above that constant documenting this dependency.
- Around line 207-212: Update the operation-profile validation in
verify_target_derivation to reject COMPATIBILITY_READ_ONLY_REQUEST_PROFILE when
the core or intent requires EXTERNAL_REQUEST_OPERATION_PROFILE/request-only
semantics. Allow the compatibility profile only when the relevant artifact
configuration explicitly permits it, while preserving existing acceptance for
canonical request-only profiles and the ArtifactShape error for disallowed
values.

In `@crates/warp-core/src/validated_workspace_patch.rs`:
- Around line 449-467: In the reconciliation success branch around
validated_workspace_patch_basis_v1, stop recording input.expected_content_digest
as witnessed before_content_digest and emit None because the pre-state was not
observed. Update validate_candidate to allow a missing before_content_digest for
reconciled Succeeded settlements while preserving the requirement for applied
successes.
- Around line 154-229: Update the module documentation near the top of
validated_workspace_patch.rs to state that the adapter guarantees no write when
the observed basis is already stale, but does not guarantee serializability
against concurrent external writers during the check-then-rename window. Clarify
that before_content_digest reflects the earlier observation and should not be
interpreted as proof that no intermediate write occurred.
- Around line 316-341: Update the obstruction method’s observed branch so the
basis hash is wrapped or mixed through the PATCH_EXTERNAL_EVIDENCE_DOMAIN before
assigning it to SettlementEvidenceV1.evidence, while preserving the existing
external_evidence(code, path) behavior when observed is absent. Apply the same
domain separation to the corresponding obstruction construction at the
additional location.
- Around line 723-738: The non-success admission branch currently accepts
arbitrary non-empty values for `evidence.obstruction`; update the validation
around `ValidatedWorkspacePatchErrorV1::SchemaAdmissionFailed` to require an
explicit allowlist of the obstruction codes produced by this module, rejecting
unknown values while preserving the existing path and evidence-field rules.
- Around line 1115-1121: Update reconciliation for the relevant attempt to
remove its deterministic staging artifact generated by temporary_name, including
artifacts left after a process crash between stage_replacement and rename.
Perform targeted cleanup using the attempt_id-derived name only, without
sweeping unrelated workspace files, while preserving normal replacement
behavior.

In `@crates/warp-core/tests/bounded_workspace_patch_tests.rs`:
- Around line 599-632: Add focused tests for the validate_candidate settlement
boundary through admit_settlement, covering tampered attempt_id, Succeeded
evidence paths outside permitted_paths, a zero external_evidence_digest, and a
recomputed schema_admission_evidence_digest. Assert each candidate is rejected
with the corresponding validation error and that workspace state remains
unchanged, using the existing setup helpers and symbols in the bounded workspace
patch tests.
- Around line 488-551: Extend stale_basis_and_path_policy_refuse_before_mutation
to verify cleanup of the staged workspace artifact after each rejected
adapter.apply call. Use the same staged-name construction or helper used by the
success test, and assert the corresponding path under root.path() does not
exist; ensure the assertions cover the stale pre-rename and failed-rename
rejection paths without changing the existing content and obstruction checks.

In `@crates/warp-core/tests/fixtures/external_action_patch/SOURCE.md`:
- Around line 6-16: Update SOURCE.md to document the provenance of
apply-validated-patch.core.sha256 and apply-validated-patch.target-ir.sha256,
including whether Edict supplies them or Echo computes them and whether cargo
xtask lawpack-goldens --write regenerates them. Define the expected refresh
procedure for these digest fixtures alongside the existing .cbor artifact
provenance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: edb93e1d-6a98-474a-a00b-baf5c6edb612

📥 Commits

Reviewing files that changed from the base of the PR and between ef39efa and 8318444.

📒 Files selected for processing (13)
  • CHANGELOG.md
  • README.md
  • crates/warp-core/src/external_action_adapter.rs
  • crates/warp-core/src/lib.rs
  • crates/warp-core/src/validated_workspace_patch.rs
  • crates/warp-core/tests/bounded_workspace_patch_tests.rs
  • crates/warp-core/tests/fixtures/external_action_patch/SOURCE.md
  • crates/warp-core/tests/fixtures/external_action_patch/apply-validated-patch.core.cbor
  • crates/warp-core/tests/fixtures/external_action_patch/apply-validated-patch.core.sha256
  • crates/warp-core/tests/fixtures/external_action_patch/apply-validated-patch.target-ir.cbor
  • crates/warp-core/tests/fixtures/external_action_patch/apply-validated-patch.target-ir.sha256
  • docs/adr/0026-durable-external-action-settlement.md
  • docs/topics/ExternalActions.md

Comment thread crates/warp-core/src/external_action_adapter.rs
Comment thread crates/warp-core/src/external_action_adapter.rs
Comment thread crates/warp-core/src/validated_workspace_patch.rs
Comment thread crates/warp-core/src/validated_workspace_patch.rs
Comment thread crates/warp-core/src/validated_workspace_patch.rs
Comment thread crates/warp-core/src/validated_workspace_patch.rs Outdated
Comment thread crates/warp-core/src/validated_workspace_patch.rs
Comment thread crates/warp-core/tests/bounded_workspace_patch_tests.rs
Comment thread crates/warp-core/tests/bounded_workspace_patch_tests.rs
Comment thread crates/warp-core/tests/fixtures/external_action_patch/SOURCE.md
@flyingrobots

Copy link
Copy Markdown
Owner Author

Merge gate at ce21333:

  • 40/40 checks terminal and passing; 0 pending; 0 failed.
  • 0 unresolved review threads.
  • CodeRabbit completed its substantive review; the current-head follow-up is terminal-success/rate-limited.
  • Local full warp-core, focused clippy, formatting, Markdown lint, determinism guard, and hook regression are clean.
  • The remaining REVIEW_REQUIRED status is the recorded solo-maintainer approval substitution; no independent collaborator is available.

Administrative merge authority will be used only to satisfy that metadata gate; no technical gate is bypassed.

@flyingrobots
flyingrobots merged commit 9c1d961 into main Jul 30, 2026
40 checks passed
@flyingrobots
flyingrobots deleted the task/711-basis-bound-workspace-patches branch July 30, 2026 10:44
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.

Execute basis-bound validated workspace patches

1 participant