Skip to content

Let a seal-only population observer skip the executor's snapshot detachment - #951

Merged
MaxGhenis merged 5 commits into
mainfrom
graph-observer-detach-main
Sep 18, 2026
Merged

MaxGhenis merged 5 commits into
mainfrom
graph-observer-detach-main

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

What this adds

run_graph(_population_observer_detach=False): an opt-in flag that lets a population observer which only seals receive the executor's live admitted population instead of a detached snapshot per reached node. Today every reached node pays pickle.dumps plus pickle.loads of the whole population for the observer, cache hits included. An observer that reads and seals needs no copy.

  • Default unchanged: True still detaches and still enforces that an observer cannot reach execution state.
  • The flag enters no key, no receipt and no cache record; a run with it produces byte-identical store objects and an identical manifest key (tested).
  • With the flag off the executor no longer enforces the observer's isolation, and the docstring says so in both halves: a mutating observer could alter execution, and could leave the store holding bytes that are not the content the node key names. The declaration is the caller's.
  • No US import; packages/microcosm-graph only.

Picked from PR #950's executor commits (9bef866 and the graph hunks of 6e3b309), which sit on the stacked native line, so the graph package on main carries the mode the US financial runner on that line calls. One adaptation: main splits run_graph into run_graph and _execute_graph (from #938), so the flag is passed through and accepted there.

Verification

packages/microcosm-graph/tests: all passed at this head in a fresh venv synced from the lock (uv sync --all-packages --locked --extra us); ruff check and ruff format --check clean on the two touched files. The four tests from the picked commit cover: no snapshot is allocated with the flag off; byte-identical store objects and manifest key with the flag on and off; the observer receives the executor's own object; the flag must be a bool and does nothing without an observer.

🤖 Generated with Claude Code

MaxGhenis and others added 4 commits September 18, 2026 08:12
run_graph(_population_observer_detach=False) passes the live admitted
population instead of allocating a detached snapshot per reached node. Opt-in,
default unchanged, no US import, and the keyword enters no key, receipt or
cache record. Four tests: no snapshot is allocated, the run exports byte-
identical store objects and an identical manifest key, the observer really
does receive the executor's own object, and the keyword is a bool that does
nothing without an observer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 9bef866)
On main run_graph hands the run to _execute_graph, which the branch this
commit was picked from did not yet have, so the flag is passed through
and accepted there. Behaviour unchanged from the picked commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… within one run

The run_graph docstring above the new keyword promised that changes to a
snapshot cannot alter execution or persistence. With detachment off, both
halves are withdrawn: a mutating observer can leave the store holding bytes
that are not the content the node key names, with the payload digest
rewritten to match, so later runs serve them as cache hits under an
unchanged key. Both are now withdrawn by name.

The seal-only observer test's default arm compared one run's snapshots
against a different run's frames, and no object from one run_graph call
can be identical to one from another, so it passed whatever the default
did. Both arms now compare within their own run; reducing
_observer_snapshot to the identity turns it red.

Picked from 6e3b309 on native-retention-seal, graph package hunks only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Sep 18, 2026
Main splits run_graph into run_graph and _execute_graph, and this branch's
keyword was read inside what used to be one function, so after the merge
every run_graph call raised NameError. Same repair as 7a74751 on the
main-based PR #951 branch: pass the keyword through and accept it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review September 18, 2026 15:04
…name the guarantees its docstring withdraws

Gate round 1 on #951 asked for both: the acceptance record's interface-freeze
section says runtime-only contract changes are numbered amendments, and the
executor docstring's 'both halves of the paragraph above' pointed at the
cost paragraph rather than the execution and persistence guarantees.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis merged commit 16c8e78 into main Sep 18, 2026
24 checks passed
juaristi22 added a commit that referenced this pull request Sep 25, 2026
…ock the interface

Main recorded the live-population observer opt-in (#950, #951) as graph amendment 25
while #918 was open, so the two amendments #918 records as 25 (a same-kind
WeightUpdate is declarable) and 26 (the context carries the version's metadata,
mass log and column order) become 26 and 27. Every code comment, docstring, test
docstring, changelog fragment, acceptance heading and receipt moves in lockstep;
the interface lock is re-recorded because the comments live in decl.py and
kernel.py. The _project_context docstring now points at _execute_graph, where
#938 moved the boundary selection, and amendment 27 states that the executor's
boundary mass logs are live references under amendment 25's opt-in. The three
root-level review artefacts of the shared-contract lane are dropped; the
experiments/ receipts stay, with a note on the renumbering and the pre-cherry-pick
commit hashes they cite.

Verified: packages/microcosm-graph/tests 690 passed, 1 skipped (junit);
tools/graph_acceptance_burndown.py --verify ok; ruff clean on the edited files.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
juaristi22 added a commit that referenced this pull request Sep 28, 2026
…ock the interface

Main recorded the live-population observer opt-in (#950, #951) as graph amendment 25
while #918 was open, so the two amendments #918 records as 25 (a same-kind
WeightUpdate is declarable) and 26 (the context carries the version's metadata,
mass log and column order) become 26 and 27. Every code comment, docstring, test
docstring, changelog fragment, acceptance heading and receipt moves in lockstep;
the interface lock is re-recorded because the comments live in decl.py and
kernel.py. The _project_context docstring now points at _execute_graph, where
#938 moved the boundary selection, and amendment 27 states that the executor's
boundary mass logs are live references under amendment 25's opt-in. The three
root-level review artefacts of the shared-contract lane are dropped; the
experiments/ receipts stay, with a note on the renumbering and the pre-cherry-pick
commit hashes they cite.

Verified: packages/microcosm-graph/tests 690 passed, 1 skipped (junit);
tools/graph_acceptance_burndown.py --verify ok; ruff clean on the edited files.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
juaristi22 added a commit that referenced this pull request Sep 28, 2026
…ock the interface

Main recorded the live-population observer opt-in (#950, #951) as graph amendment 25
while #918 was open, so the two amendments #918 records as 25 (a same-kind
WeightUpdate is declarable) and 26 (the context carries the version's metadata,
mass log and column order) become 26 and 27. Every code comment, docstring, test
docstring, changelog fragment, acceptance heading and receipt moves in lockstep;
the interface lock is re-recorded because the comments live in decl.py and
kernel.py. The _project_context docstring now points at _execute_graph, where
#938 moved the boundary selection, and amendment 27 states that the executor's
boundary mass logs are live references under amendment 25's opt-in. The three
root-level review artefacts of the shared-contract lane are dropped; the
experiments/ receipts stay, with a note on the renumbering and the pre-cherry-pick
commit hashes they cite.

Verified: packages/microcosm-graph/tests 690 passed, 1 skipped (junit);
tools/graph_acceptance_burndown.py --verify ok; ruff clean on the edited files.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
juaristi22 added a commit that referenced this pull request Sep 28, 2026
…ock the interface

Main recorded the live-population observer opt-in (#950, #951) as graph amendment 25
while #918 was open, so the two amendments #918 records as 25 (a same-kind
WeightUpdate is declarable) and 26 (the context carries the version's metadata,
mass log and column order) become 26 and 27. Every code comment, docstring, test
docstring, changelog fragment, acceptance heading and receipt moves in lockstep;
the interface lock is re-recorded because the comments live in decl.py and
kernel.py. The _project_context docstring now points at _execute_graph, where
#938 moved the boundary selection, and amendment 27 states that the executor's
boundary mass logs are live references under amendment 25's opt-in. The three
root-level review artefacts of the shared-contract lane are dropped; the
experiments/ receipts stay, with a note on the renumbering and the pre-cherry-pick
commit hashes they cite.

Verified: packages/microcosm-graph/tests 690 passed, 1 skipped (junit);
tools/graph_acceptance_burndown.py --verify ok; ruff clean on the edited files.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant