[P2] Add effect identity and once-only observation ledger for recursive execution #427

Closed
opened 2026-09-10 21:18:03 +00:00 by nsaspy · 1 comment
Owner

Goal

Prevent Prolog backtracking, recursive retries, sync/async wrappers, and restart from accidentally repeating paid or stateful external effects.

Current state — 2026-08-18

Canonical main inspected: abfc30ebb9f335d5841c1f7910bd474da905ebcf.

The generic durable-effect substrate is merged, but canonical adoption is not complete.

Completed substrate slices:

  • #78 / 7af5d5f6dc833c70bd547571654485eb73a1a704 — durable call/attempt identity, immutable observations, explicit retry/resample lineage, replay, authority composition, async integration, persistence, and conservative reconciliation.
  • #83 / 6c60924cef7a03b9d483e4691646d4d56a13c0f3 — identity, retention, adapter, recovery, stale-ticket, crash, and concurrency hardening.
  • #85 / 88433863056cd39a1d152db2c0a3cbf1a7f43fc0 — explicit offline migration for non-empty pre-v2 journals.

#57 remains open because the guarantee applies only when canonical effectful execution crosses this boundary. #79 owns adoption across the real tool, model/provider, effectful MCP, MCP lifecycle/process, and external-tool paths.

Open PR #86 is only the first #79 tool-path slice. It is not merged evidence and does not satisfy the remaining #57/#79 acceptance boundary.

#44 and #45 remain separate public accounting/trajectory defects. The effect ledger supplies durable lineage for those fixes but does not complete them.

Required semantics

  • replay/reuse observes recorded work without re-executing it;
  • retry and resample are explicit linked attempts;
  • changed executable payload creates new identity and requires the appropriate fresh authority decision;
  • ordinary backtracking and repeated waits do not create another external submission;
  • uncertain remote outcomes remain conservative until reconciled or explicitly resolved by trusted policy;
  • sync and async surfaces observe the same underlying operation rather than duplicating it.

Acceptance criteria

These are end-to-end criteria. Substrate milestones above are complete, but criteria that require canonical adoption remain unchecked until those paths are on main.

  • Stable normalized effect identity is used by canonical effectful paths.
  • One authoritative observation is recorded per executed canonical attempt.
  • Backtracking over a completed canonical observation does not repeat the external effect.
  • Explicit retry creates linked attempt identity.
  • Explicit resample is distinguishable from replay/reuse.
  • Changed payload requires new identity and fresh authority evaluation.
  • allow_once cannot leak across retry, resample, parallel attempts, or modified payloads.
  • Sync/async wrappers and repeated waits cannot duplicate one canonical operation.
  • Cancelled, failed, or uncertain canonical effects retain deterministic durable state.
  • Executed effects remain available to accounting when later logic fails.
  • Tests cover backtracking, repeated waits, retry, resample, cancellation, parallel attempts, stale approval identity, post-effect failure, and fresh-process recovery at canonical integration boundaries.

Non-goals

  • No competing generic effect ledger.
  • No permanent memoization requirement for pure/fresh reads.
  • No replacement of #44/#45 public accounting and trajectory work.
  • No unrestricted executable capability derived from arbitrary Prolog terms.

References

#79, #44, #45, completed #53, #54, docs/effect-runtime.md, docs/effect-migration.md, and the logic-native control-plane research tracked by open PR #58.

## Goal Prevent Prolog backtracking, recursive retries, sync/async wrappers, and restart from accidentally repeating paid or stateful external effects. ## Current state — 2026-08-18 Canonical `main` inspected: `abfc30ebb9f335d5841c1f7910bd474da905ebcf`. The generic durable-effect substrate is merged, but canonical adoption is not complete. Completed substrate slices: - [x] #78 / `7af5d5f6dc833c70bd547571654485eb73a1a704` — durable call/attempt identity, immutable observations, explicit retry/resample lineage, replay, authority composition, async integration, persistence, and conservative reconciliation. - [x] #83 / `6c60924cef7a03b9d483e4691646d4d56a13c0f3` — identity, retention, adapter, recovery, stale-ticket, crash, and concurrency hardening. - [x] #85 / `88433863056cd39a1d152db2c0a3cbf1a7f43fc0` — explicit offline migration for non-empty pre-v2 journals. #57 remains open because the guarantee applies only when canonical effectful execution crosses this boundary. #79 owns adoption across the real tool, model/provider, effectful MCP, MCP lifecycle/process, and external-tool paths. Open PR #86 is only the first #79 tool-path slice. It is not merged evidence and does not satisfy the remaining #57/#79 acceptance boundary. #44 and #45 remain separate public accounting/trajectory defects. The effect ledger supplies durable lineage for those fixes but does not complete them. ## Required semantics - replay/reuse observes recorded work without re-executing it; - retry and resample are explicit linked attempts; - changed executable payload creates new identity and requires the appropriate fresh authority decision; - ordinary backtracking and repeated waits do not create another external submission; - uncertain remote outcomes remain conservative until reconciled or explicitly resolved by trusted policy; - sync and async surfaces observe the same underlying operation rather than duplicating it. ## Acceptance criteria These are end-to-end criteria. Substrate milestones above are complete, but criteria that require canonical adoption remain unchecked until those paths are on `main`. - [ ] Stable normalized effect identity is used by canonical effectful paths. - [ ] One authoritative observation is recorded per executed canonical attempt. - [ ] Backtracking over a completed canonical observation does not repeat the external effect. - [ ] Explicit retry creates linked attempt identity. - [ ] Explicit resample is distinguishable from replay/reuse. - [ ] Changed payload requires new identity and fresh authority evaluation. - [ ] `allow_once` cannot leak across retry, resample, parallel attempts, or modified payloads. - [ ] Sync/async wrappers and repeated waits cannot duplicate one canonical operation. - [ ] Cancelled, failed, or uncertain canonical effects retain deterministic durable state. - [ ] Executed effects remain available to accounting when later logic fails. - [ ] Tests cover backtracking, repeated waits, retry, resample, cancellation, parallel attempts, stale approval identity, post-effect failure, and fresh-process recovery at canonical integration boundaries. ## Non-goals - No competing generic effect ledger. - No permanent memoization requirement for pure/fresh reads. - No replacement of #44/#45 public accounting and trajectory work. - No unrestricted executable capability derived from arbitrary Prolog terms. ## References #79, #44, #45, completed #53, #54, `docs/effect-runtime.md`, `docs/effect-migration.md`, and the logic-native control-plane research tracked by open PR #58.
Author
Owner

Duplicate of #57 (pre-existing Forgejo mirror with GitHub number parity). Closing this accidental duplicate created by today's open-state sync; #57 stays canonical on Forgejo.

Duplicate of #57 (pre-existing Forgejo mirror with GitHub number parity). Closing this accidental duplicate created by today's open-state sync; #57 stays canonical on Forgejo.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/prolog-rlm#427
No description provided.