Repository navigation
Conversation
…n inputs Failing tests for decision 1.5 · 6, part A: under --stage all, one child process runs the 16 steps from capital_gains_tail_transfer to education_inputs_post_clone instead of one process per step. - The child reads only the first step's predecessor checkpoint; each later step takes the frame the step before it completed. Each step still writes its checkpoint, completion record, profile record and saved check observations. A fixture test compares every file the 16 steps write with the files 16 single-step runs write, and each in-memory input with what reading the previous checkpoint gives. - Before each step the child writes the step's name to a pipe its parent opened (MICROCOSM_US_BASE_STEP_REPORT), and the parent records one telemetry stage change per step. A named --stage run by hand still runs one step. - The parent-digest tests now expect one step process for the 16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A report variable the --stage all parent inherited from its own environment must reach none of its single-step children. The fixture test also requires the 16 steps' saved check observations to exist before it compares the files of both runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decision 1.5 · 6, part A. Under --stage all, the parent starts one child for the steps from capital_gains_tail_transfer to education_inputs_post_clone that are still to run (ONE_PROCESS_STEPS), instead of one child per step. Every other step keeps its own process. - The child reads the first step's predecessor checkpoint from disk and hands each later step the frame the step before it completed. Each step still goes through the per-step code (_run_outer_step): its profile record, saved check observations, identity check, checkpoint and completion record, and the input frame is still freed before the checkpoint write. A resume inside the 16 starts the child at the first unfinished step. - Before each step the child writes the step's name to a pipe whose file descriptor the parent passes in MICROCOSM_US_BASE_STEP_REPORT, with its process ID. The parent records one telemetry stage change per step and names the step that failed. A report that is not the next step stops the child; so does an exception in the parent, as with subprocess.run. - A step process uses the variable only when its parent set it and its --stage is one of the 16. A named --stage run by hand runs one step. Single-step children get no report variable. - Docs: the variable's row in docs/orrery-publication.md, and the Modal plan's comment on how --stage all runs its steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Failing tests from review round 1: - The child for the 16 steps compares the run config with the locked one before each step, as each step process does at its start, so a change to the builder's source files during the run stops it before the next step. - The child makes the report pipe's write end non-inheritable, so a process it starts cannot keep the parent waiting for the end of the reports. - A report variable naming a descriptor that is not an open pipe stops the step process instead of letting it write step names into another file. - A child that exits cleanly without reporting any step gets an error that says so and names the variable. Also a passing guard: each step frees the frame it was handed before its checkpoint write. The stand-in steps now read every table, the strata and all weights. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes from review round 1: - The child for the 16 steps compares the run config with the locked one before each step after the first, as each step process does at its start (decision of 2026-11-26 in #1747), so a change to the builder's source files during a run stops it before the next step. - The child makes the report pipe's write end non-inheritable, so a process a step starts cannot keep the parent waiting for the reports. - A report variable naming a descriptor that is not an open pipe stops the step process. The variable's comment and docs row say that the process-ID comparison can match a copy where process IDs repeat, and when the variable takes effect. - A child that exits cleanly without reporting any step gets an error that says so. - The ONE_PROCESS_STEPS comment notes that a frame handed over keeps its records of shared column memory, which a frame read from disk lacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review round 2 and Anthony's choice of a real-process baseline: - test_one_child_writes_the_same_files_as_16_separate_step_processes runs the 16 steps in 16 real step processes, then in one real child started through _run_one_process_steps, and compares the SHA-256 of every file they write: the 16 checkpoints, the run context and the 16 saved observation files. Each process gets the test process's policyengine-us lock-file check record, as a --stage all parent's step processes do. - The stand-in steps evaluate each step's us/gates.json entry through the shadow evaluation, so the compared observation files hold entries. - Failing: after a Ctrl-C the parent waits 0.25 s for its child before stopping it, as subprocess.run does; the report pipe never takes descriptor 0, 1 or 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes from review round 2: - After a Ctrl-C, which the child gets too, the parent waits up to 0.25 s for it before stopping it, as Popen.wait does under subprocess.run, so the failing step can save its observations and profile record. - The report pipe's ends are moved above descriptor 2 when os.pipe returns a standard stream's descriptor (a parent started with one closed); otherwise the write end could become the child's standard error. - Docs: the descriptor check applies only where the variable takes effect; the changelog says how the change was checked, that 15 of the 16 fixture steps are stand-ins, and that the base bit-equivalence test was not run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Anthony's choice (2026-11-28) for review round 2's open gap: reading a checkpoint turns NumPy scalars in object columns, an object index or object strata into Python values, and a frame handed over in memory keeps them. Failing test: the child stops, once the step that left them has completed, before the next step takes the frame. The last of the 16 may leave them, since its frame is read from disk by the next process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Before a step of the 16 takes the previous step's frame from memory, the child checks the types of the values in its object columns, object index values and object strata. If reading the checkpoint would turn any into another type (NumPy scalars become Python values), it stops with an error naming the step, the place and the types; the previous step has completed, so a resume reads its checkpoint. About 30 ms on a post-clone frame's 2.3 million object values. No step leaves such values today. The ONE_PROCESS_STEPS comment also records why memory layout is not checked: pandas 3 copies columns into new memory when it builds a table, and no step builds one with copy=False. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review round 3. Failing: the child also stops before handing over NumPy scalars in a python-backed str column (pandas keeps np.str_ there; a read gives str) and in the strata's own index (Frame compares it with the person index by value; a read replaces it with the person index). The stand-in steps now write a digest of every value with its type, every dtype (column labels included), the indexes, the strata and their index, the weights, the mass log and the frame metadata, next to a floating-point sum of each person's numeric and boolean values. Before, boolean columns, non-string object values, index values and the column labels' dtype did not reach their output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes from review round 3: - The check before a step takes a frame from memory now also covers python-backed str columns and indexes, which keep the np.str_ values they are given, and the strata's own index, which a read replaces with the person index. - The ONE_PROCESS_STEPS comment and the changelog name the two differences that are not checked, because a check could stop a run whose output would be the same: a read gives each missing value in an object column its own NaN object, and gives column labels the str dtype. - The changelog says how "no step leaves such values" was established (code review, not a run), what the fixture's stand-ins read, and the check's measured cost (30 to 117 ms per handover). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracker task 1.5 · 7 in project 15 (US build memory, CPU and run time), carrying out part A of decision 1.5 · 6.
What changes
tools/build_us_puf_support_base.py --stage allused to start one child process per step. It now starts one child process for those of the 16 steps fromcapital_gains_tail_transfertoeducation_inputs_post_clone(ONE_PROCESS_STEPS) that are still to run. Every other step keeps a process of its own._CarriedCheckpoint). The holder hands the frame over and keeps no reference to it. So each step still frees its input frame before its own checkpoint write, as US base: free each step's input frame before its checkpoint write #1799 does._run_outer_step, the former body of_run_outer_stage), and still:stage_profile.jsonrecord and its saved observations of theus/gates.jsonchecks, so a stopped run resumes after the last finished step;np.float32into a 64-bitfloat,np.str_intostr) in these places:strcolumns and indexes;_refuse_values_a_checkpoint_read_changes). It stops if reading the checkpoint would change any of them, naming the step, the place and the types.MICROCOSM_US_BASE_STEP_REPORT. The child writes each step's name to the pipe as the step starts.subprocess.rundoes.--stageis one of the 16. A named--stagerun by hand still runs one step.MICROCOSM_US_BASE_PARENT_DIGESTSdoes (Hash the US base input files once per staged run #1747). So does one that names a descriptor that is not an open pipe, where the variable would take effect.What one process gives up (accepted in the decision)
stage_profile.jsonwill show it, since Linux, including Modal, keeps a sampled peak per step.congressional_district_assignmentorhousehold_location_assignment, or a resume.setandinon the raw values can differ.strdtype a new table gets.copy=False. Review found no table built that way in the 16 steps' code, so this is not checked.How this was checked
The base bit-equivalence test was not run: task 1.5 · 8 was cancelled. The finish condition is the fixture test below.
test_one_child_writes_the_same_files_as_16_separate_step_processes:_run_one_process_steps).us/gates.jsonentry, so the observation files hold entries.capital_gain_distributionsruns its real code.--stage allparent's step processes do._run_staged_allunstubbed.test_one_child_hands_each_step_the_frame_its_checkpoint_holds: in one process, it checks that each frame handed over equals what reading the previous checkpoint gives, by value and dtype, and equals the frame a single-step run read.Other tests cover:
Parent-digest tests: in
test_us_puf_support_base_parent_digests.py, the stand-in now also stands in forsubprocess.Popen, and the tests that listed one process per step now expect one process for the 16.How the tests were run: each new or changed test was run by node ID; no full suite was run.
Red-green commits:
Estimated saving (inferred in the 1.5 · 6 decision, not measured): about 4 to 6 minutes and 4 to 6 CPU-minutes per Modal base run, less about 3 to 12 s for the 15 extra run-config comparisons.
Review
Three rounds of adversarial review by subagents. None found a change in the bytes the code writes.
subprocess.rungives.strcolumns and the strata's index.tools/modal_us_stage_plan.pydoes not refuse a plan that setsMICROCOSM_US_BASE_STEP_REPORT(as it does not refuseMICROCOSM_US_BASE_PARENT_DIGESTS). Plans only run--stage all, whose parent removes the variable from every child's environment.🤖 Generated with Claude Code