Skip to content

Bind observation settlements to their basis evidence - #27

Merged
flyingrobots merged 2 commits into
mainfrom
task/26-observation-settlement-evidence
Aug 4, 2026
Merged

Bind observation settlements to their basis evidence#27
flyingrobots merged 2 commits into
mainfrom
task/26-observation-settlement-evidence

Conversation

@flyingrobots

Copy link
Copy Markdown
Owner

Closes #26.

What was wrong

The observation report projected five settlement fields. patch-host projected eleven. The three that mattered were absent: basisDigest, externalEvidenceDigest, and schemaAdmissionEvidenceDigest.

A regression in BoundedWorkspaceObservationAdapterV1 that retained a basis over the wrong bytes was invisible to the witness, which checked the returned file contents and nothing about the durable evidence recorded beside them.

The part that was not obvious

Projecting the fields is three lines. Making them checkable was the actual work, and the first approach I tried was vacuous.

A succeeded observation cannot establish the binding. The adapter derives a basis over what it read and refuses with stale-basis unless that equals the requested basis:

let observed_basis = bounded_workspace_observation_basis_v1(/* what was read */);
if observed_basis != grant.request().basis_digest {
    return self.refused_candidate_with_evidence(grant, "stale-basis", observed_basis);
}

So on the success path basisDigest and externalEvidenceDigest are equal by construction, and asserting it proves nothing — the same class of assertion review of #24 spent several rounds removing.

What is actually proven

The stale-basis refusal is the one settlement family where the retained evidence is independently informative: it carries a basis over what was actually found, which by construction is not what the request declared.

The witness reaches that same value by a second route — a separate successful observation declaring those exact bytes derives a basis over the same (path, bytes) pair. Recomputing Echo's domain-separated hash in the consumer would rebuild producer logic across the boundary this witness exists to hold.

Observed values:

refusal basisDigest (declared, over 'secret') 3536d993…
refusal externalEvidenceDigest (over what was found) a4e83804…
independent success over those same bytes a4e83804…

Two guards keep that equality from being satisfied by a constant: the refusal evidence must not equal the requested basis, and the basis must differ for different bytes on a fixed path.

Verification

Mutation-tested. Projecting basis_digest in place of external_evidence_digest — exactly the single-arbitrary-value producer the two-route derivation exists to catch — fails the witness. Restoring it passes.

Full CI gate run locally against the pinned producers (df80f92a / c354d531):

gate
producer-lock PASS
runtime PASS
effect-runtime PASS
patch-runtime PASS
build-cleans-output PASS
writer-epoch-assertions PASS

The observation report projected five settlement fields; patch-host
projected eleven. The three that mattered were absent: basisDigest,
externalEvidenceDigest, and schemaAdmissionEvidenceDigest. A regression
in BoundedWorkspaceObservationAdapterV1 that retained a basis over the
wrong bytes was invisible to the witness, which checked the returned
file contents and nothing about the durable evidence beside them.

effect-host now projects attemptId, basisDigest, externalEvidenceDigest,
and schemaAdmissionEvidenceDigest, as patch-host does.

Making them checkable took more than asserting they are present. A
succeeded observation cannot establish the binding at all: the adapter
derives a basis over what it read and refuses with stale-basis unless
that equals the requested basis, so on the success path the two agree by
construction and comparing them proves nothing. That is the vacuous
assertion class review of #24 spent several rounds removing, and it is
the shape this change had to avoid.

The stale-basis refusal is the one settlement family where the retained
evidence is independently informative. It carries a basis over what was
actually found, which by construction is not what the request declared.
The witness reaches that same value by a second route: a separate
successful observation declaring those exact bytes derives a basis over
the same (path, bytes) pair. Recomputing Echo's domain-separated hash in
the consumer would have rebuilt producer logic across the boundary this
witness exists to hold.

Two guards keep the equality from being satisfied by a constant: the
refusal evidence must not equal the requested basis, and the basis must
differ for different bytes on a fixed path.

Verified by mutation: projecting basis_digest in place of
external_evidence_digest, which is exactly the single-arbitrary-value
producer the two-route derivation exists to catch, fails the witness.
Full CI gate passes locally against the pinned producers.

Closes #26
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

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: 39 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b4751e70-5d78-4f36-9ebe-b4e89a0a4942

📥 Commits

Reviewing files that changed from the base of the PR and between 725e4dc and 6adee6d.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • docs/roadmap.md

Summary by CodeRabbit

  • New Features

    • Settlement reports now include identifiers for the attempt, observed basis, external evidence, and schema admission evidence.
    • Reports bind settlement identities to the data actually observed.
  • Bug Fixes

    • Stale-basis requests are rejected while retaining the newly discovered basis.
    • Identical observed data produces consistent basis values, while different data produces distinct values.
  • Documentation

    • Updated the observation roadmap to describe these evidence-binding behaviors.

Walkthrough

Observation settlement reports now expose attempt and evidence identities. Runtime tests validate these identities for successful and rejected settlements, including stale-basis handling and independent derivation from observed bytes. Roadmap and changelog entries document the verification behavior.

Changes

Observation Evidence Binding

Layer / File(s) Summary
Project settlement identities
effect-host/src/main.rs
Settlement reports now include attempt, basis, external-evidence, and schema-admission digests.
Validate settlement evidence
tests/effect-runtime.sh
Successful and rejected settlement cases now require the evidence digest fields.
Bind evidence to observed bytes
tests/effect-runtime.sh, docs/roadmap.md, CHANGELOG.md
Stale-basis tests compare retained evidence with independently derived values, verify requested-basis non-echoing, and confirm digest changes for different bytes. Documentation records the same verification details.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RuntimeTests as tests/effect-runtime.sh
  participant EffectHost as effect-host
  participant ObservedBytes as observed bytes
  RuntimeTests->>EffectHost: request settlement report
  EffectHost->>ObservedBytes: read settlement observation
  EffectHost-->>RuntimeTests: return settlement identities
  RuntimeTests->>ObservedBytes: independently derive basis
  RuntimeTests-->>RuntimeTests: compare retained and derived basis
Loading

Possibly related PRs

Poem

Bytes are read, and proofs align,
Basis threads through every line.
Stale requests now leave a trace,
Changed content shifts the case.
Reports speak with hashes bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies binding observation settlements to their basis evidence, which is the primary change.
Description check ✅ Passed The description directly explains the missing settlement fields, the witness gap, the two-route derivation, and verification results.
Linked Issues check ✅ Passed The changes project the required identities and add two-route witness checks for observed-byte equality, requested-basis inequality, and differing bytes.
Out of Scope Changes check ✅ Passed The code, tests, changelog, and roadmap updates directly support the linked issue objectives and contain no unrelated changes.

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

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@tests/effect-runtime.sh`:
- Line 184: Extend the unknown-report assertions alongside
assert_settlement_evidence to validate all four settlement digest fields, not
only settlement/posture/commit-kind and empty-file conditions. Derive the
observed external evidence independently and require externalEvidenceDigest to
match that value, preventing claimed or stale bytes from satisfying the witness.
🪄 Autofix

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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2fbbfa36-99b1-41b5-89a3-90d5c84a2e0c

📥 Commits

Reviewing files that changed from the base of the PR and between f435b5e and 725e4dc.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • docs/roadmap.md
  • effect-host/src/main.rs
  • tests/effect-runtime.sh
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Witness gate
🔇 Additional comments (4)
effect-host/src/main.rs (1)

519-529: LGTM!

tests/effect-runtime.sh (1)

129-141: LGTM!

Also applies to: 523-567, 730-730

docs/roadmap.md (1)

122-126: LGTM!

CHANGELOG.md (1)

83-95: LGTM!

Comment thread tests/effect-runtime.sh
and (.settlement.commitDigest | test("^[0-9a-f]{64}$"))
and (.settlement.resultDigest | test("^[0-9a-f]{64}$"))' \
"$case_root/settlement-report.json" >/dev/null
assert_settlement_evidence "$case_root/settlement-report.json"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 6 \
  'uncert|outcomeUnknown|assert_settlement_evidence|externalEvidenceDigest|basisDigest' \
  tests/effect-runtime.sh

Repository: flyingrobots/hello-echo

Length of output: 5105


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | sed -n '1,200p'

echo "== effect-runtime outline =="
wc -l tests/effect-runtime.sh
sed -n '1,80p;180,470p;500,575p' tests/effect-runtime.sh

echo "== repository references to uncertainty/assert settlement evidence/evidence ids =="
rg -n --hidden --iglob '!*.lock' --iglob '!node_modules/**' \
  'uncertainty|outcomeUnknown|assert_settlement_evidence|externalEvidenceDigest|basisDigest|schemaAdmissionEvidenceDigest|retained.observed|settlement-report.json|unknown-report.json' .

Repository: flyingrobots/hello-echo

Length of output: 29247


Bind uncertainty assertions to retained observed evidence.

unknown-report.json only checks settlement/posture/commit-kind fields and empty files. Apply the same evidence contract there: check the four settlement digest fields and link externalEvidenceDigest to an independently derived observed value so a stale/ambiguous actual observation does not satisfy the witness by replaying claimed bytes.

🤖 Prompt for 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.

In `@tests/effect-runtime.sh` at line 184, Extend the unknown-report assertions
alongside assert_settlement_evidence to validate all four settlement digest
fields, not only settlement/posture/commit-kind and empty-file conditions.
Derive the observed external evidence independently and require
externalEvidenceDigest to match that value, preventing claimed or stale bytes
from satisfying the witness.

…ishes

The roadmap listed four projected identities and said they were bound to
the bytes that were actually read. Only the external-evidence digest is,
and only in the stale-basis refusal family. The attempt identity is not a
digest of observed bytes, the requested basis is by construction the
value the request declared, and no case exercises the schema-admission
digest at all.

The second route is also named more precisely. It is a second settlement
path through Echo's own basis derivation, not a second implementation of
it: a defect inside bounded_workspace_observation_basis_v1 would appear
identically on both routes.

The projection and its witness are unchanged. Only the claims move.
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.

Observation settlements cannot be bound to their basis evidence

1 participant