Add atomic Resource proposal publication - #409
Conversation
agent-identity: dev3.direct.omp.2cshu64q agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.0.9 agent-runtime: OMP 18.0.9 tooling-profile: dotfiles@b607597
|
@codex please review this PR. Posted on behalf of @schickling
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c778bbca7
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | **Tracked workspaces fail closed** | Materialization simulates content operations before writing and refuses a real change to any Git-tracked target. Byte-identical tracked, untracked, and non-Git targets retain useful behavior. | `tests/materialize.rs::every_content_directive_refuses_to_change_a_tracked_target_before_any_write`; `tests/materialize.rs::byte_identical_tracked_target_is_allowed_without_modification`; `tests/materialize.rs::untracked_and_non_git_targets_remain_materializable` | | ||
| | **Native flat root** | Without an authored override, catalog tasks, eval messaging, shell helpers, and DING all use the catalog itself as `ST_ROOT`; no nested bus directory is synthesized. | `src/eval_run.rs::bus_root_expands_st_root_else_defaults`; `tests/eval_run_e2e.rs::st2_eval_runs_a_benign_folder_to_a_pass_verdict`; `tests/pty.rs` | | ||
| | **Resource observation is state-first, atomic, and fenced** | ABI-3 periodic publication and demanded `Published` results reuse one bounded `Publication` payload and one host acceptance, digest, relevance, typed-fact, and catch-up core; the host never trusts a runtime digest or observation timestamp. Demand reaches only a resident runtime that explicitly declares `capability "demand"`. Every `Observe` carries a positive watermark and the exact owner, binding, and registration, and exactly one matching `Unchanged`, `Failed`, or `Published` atomic result closes it. One outstanding dispatch plus one latest trailing watermark coalesces bursts without losing in-flight arrivals. Backpressure retains queued demand, replacement fences stale output, restart and provider failure settle honestly, and client disconnect or wait expiry never cancels accepted work. | `tests/resource_profile_supervisor_e2e.rs::demand_observation_settlement_matrix_is_atomic_and_preserves_facts`; `tests/resource_profile_supervisor_e2e.rs::demand_observation_coalesces_and_fences_watermarks`; `tests/resource_profile_supervisor_e2e.rs::demand_observation_survives_restart_disconnect_and_denies_missing_capability`; `tests/resource_profile_supervisor_e2e.rs::observable_publication_reaches_builtin_resync_with_filter_catch_up_and_scope_isolation`; `tests/agent_resource.rs::refresh_cli_reports_exact_receipts_and_wait_expiry_keeps_the_request`; `src/resource_observe.rs::tests::receipt_evidence_shape_matches_atomic_results` | | ||
| | **Atomic resource proposal publication** | Every changed resource publication is one host-owned compare-and-swap fenced by binding generation, state revision, and prior carrier digest. A persistent cross-process lock admits at most one proposal from the same prior. The content-derived proposal ID binds the accepted carrier digest and semantic outbox envelope; the durable intent becomes eligible only with the exact canonical carrier, then folds into one authoritative catch-up state. A pre-carrier crash exposes old state, a post-carrier crash catches up on restart, and retry after a lost acknowledgement returns the durable receipt without another transition. Ordinary reconciliation fails closed on out-of-band divergence after a committed intent; only an explicit generation-advance recovery may re-adopt the canonical carrier or its absence while invalidating the old intent and fence. | `src/resource_profile.rs::atomic_publication_fences_races_and_survives_crash_restarts`; `src/resource_profile.rs::generation_advance_explicitly_recovers_diverged_or_missing_carrier` | |
There was a problem hiding this comment.
Add the invariant's referenced proof tests
Running tests/invariants.rs::qualified_proof_references_resolve fails because neither atomic_publication_fences_races_and_survives_crash_restarts nor generation_advance_explicitly_recovers_diverged_or_missing_carrier is declared in src/resource_profile.rs; the first missing reference triggers the panic immediately. Add the named tests or reference existing proofs so this new invariant does not make the test suite unconditionally fail.
Useful? React with 👍 / 👎.
Problem
Observable Resource providers need to publish a carrier and its delivery intent as one fenced operation. Separate writes can lose invalidation, replay stale work, or wedge after a crash.
Goal
Provide a reusable proposal commit primitive with generation, revision, and prior-digest compare-and-swap semantics.
Decisions
Verification
CI=1 nix develop -c cargo test -p st2-resource-protocolCI=1 nix develop -c cargo test --lib resource_profileCI=1 nix develop -c cargo test --test invariantsaxe vrs check --profile strict docs/vrs/07-resource-profileAll commands passed locally. Tests cover crash recovery, lost acknowledgements, multiprocess contention, stale fences, divergence recovery, and legacy intent migration.
Complexity
The persistent lock and intent record are necessary to make carrier publication and notification one recoverable transaction across process crashes.
Concerns
This PR changes the durable proposal intent schema. The implementation includes explicit migration coverage for predecessor intents.
Friction & bottlenecks
The repository has no
devenvtask graph, so validation uses its Cargo and Nix gates directly.Follow-ups
The next PR in stack #412 adds the universal WASIp2 executor that consumes this primitive.
References
Posted on behalf of @schickling
agent_identitysessionagent_personaagent_supervisoragent_toolagent_tool_versionagent_runtimetooling_profile