Repository navigation
Move a page's inputs out of served_state, below the modules that watch and stamp them - #7122
Merged
Merged
Conversation
`unlined`, the user's turns in a thread that no word of the agent's has reached since the oldest of them, is a pure fold over a built thread: it reads only `events.unanswered_turns` and `events.spoken_turns`, which it imported inside its body. Two modules read it, the line fork's follower (`forks.look`, `forks._awaits_line`) and the delivery envelope (`thread_context.batch_threads`). Defined in `forks`, it made `thread_context` reach up past `forks`' imports of the service, leases and state through a deferred import. In `events` it sits beside `unanswered_turns` and `owed_turns`, and both readers import it downward. Behavior is unchanged. The import-linter allowance `leaf.thread_context -> leaf.forks` goes with the import.
`activity` decides where the agent's work stands from the obligation records `obligations` produces, so it belongs above that module. The order had it below, because `obligations` reached `activity` back through `thread_context`'s deferred import of `forks`; with `unlined` moved into `events`, no path from `obligations` leads back to `activity`, and the allowance `leaf.activity -> leaf.obligations` goes. Only `.config/importlinter.ini` changes; no code or behavior does.
…llers `served_state/reading.py` declared which writes count as a page's inputs and took the stamps that say whether they moved. Its callers are the watchers (`file_changes`, `session.Watch`), activation (`revisioning`), publishing, the row publisher and the hooks, none of which project state, and it imported nothing of the projection. Inside `served_state` it stood at the projection's level, so each of those callers imported upward. As the top-level `page_inputs`, below `file_changes`, they import downward, and `served_state` holds only the served state: the page read it folds, its projection, and the patch a tab holding an earlier reading is sent. `version_written` moves to `revision_artifact`, beside `CAPTURED_TREES`: it says when a file a version is built from was last written, and that set of files is the revision's inputs. Its deferred import of `CAPTURED_TREES` goes with it. It reads the stamps through `page_inputs.page_stamps`, formerly `_page_stamps`. `file_bindings` moves down the import order to stand below `page_inputs`, which imports it. Five allowances end (`file_changes`, `publishing`, `revisioning`, `server_rows` and `session` -> `served_state.reading`), leaving 72. Behavior is unchanged.
…ve its checks `package_layer_inputs` gives the layer inputs a page selecting one package composes: `layer_inputs()` with the package appended once. That is layer input resolution, the subject of `layer`, beside `layer_inputs` and `checked_layer_inputs`. Kept in `packages`, the module of the `package` commands, it made `render_gate.widget_quality` import the command module, so `packages` stood below `render_gate` and `cmd_package_check` reached up to `render_gate.command` against the order. With the function in `layer`, `render_gate` no longer imports `packages`, and `packages` stands above `render_gate`, as `validation` (the `page check` command) stands above the checks it runs. The allowance `leaf.packages -> leaf.render_gate.command` goes. Behavior is unchanged.
The session commands (`session`), the page host (`hosting`), its row publisher (`server_rows`), the page server (`http`) and `leaf page state` (`agent_state`) each read the served state, and nothing in `served_state` imports any of them directly. The greedy order had placed them below it, so each of those reads was allowed as a backward import. Standing the five modules just above `served_state`, in the order they import each other, makes those reads point down. Every import cycle they sit on keeps a backward edge elsewhere (`presence -> session`, `clerk -> agent_state`, `vendoring -> hosting`), so no allowance is added. Eight allowances end: `http` -> `served_state.service` and `served_state.tail`, `agent_state` -> `served_state.context` and `served_state.page`, `session` -> `served_state.context`, `server_rows` -> `served_state.service`, and, from `hosting` now standing above them, `hosting` -> `clerk` and `http`. 64 remain. Only the order changes; no code does.
# Conflicts: # src/leaf/render_gate/handover_pass.py
# Conflicts: # .config/importlinter.ini
leaf-agent
previously approved these changes
Nov 25, 2026
# Conflicts: # .config/importlinter.ini
# Conflicts: # .config/importlinter.ini
leaf-agent
approved these changes
Nov 25, 2026
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.
served_state/reading.pydeclared which writes count as a page's inputs (page_input,page_roots,outside_inputs) and took the stamps over them (page_reading,source_readings,record_reading,join_reading). Its callers are the file watchers, activation, publishing, the row publisher and the hooks, none of which projects state, and it imported nothing from the projection. It becomes the top-level modulepage_inputs, below its callers, andserved_stateholds only the served state: the page read, its projection, and the patch sent to a tab holding an earlier reading.version_written, which names when the files a version is built from last changed, moves torevision_artifactbesideCAPTURED_TREES, ending its deferred import.session,hosting,server_rows,httpandagent_statenow stand just aboveserved_statein.config/importlinter.ini, since each reads the served state andserved_stateimports none of them. Only the order changes for those, in a commit of its own.src/leaf's allowed backward imports go from 64 to 51. Behavior is unchanged..config/importlinter.iniwill conflict with #7061 and #7114 on one hunk: this branch deletes theleaf.session -> leaf.served_state.*allowances, and both PRs delete the adjacentleaf.session_runtime -> leaf.harness. Deleting all three lines resolves it, andlint-importschecks the result. Every other file merges cleanly with both. From their files, this touches import lines inhooks.py,session.py,render_gate/handover_pass.pyandworker/leaf_website/storage.py, and one docstring line inpresence.py.max-sixty asked for refactoring to continue while each change improves the code.
Tests:
lint-importsand pre-commit pass, as do the model tests for file bindings, native watches, the handover pass, seen, hook registration, model folds, the render gate and render export, the website's saved records and the revendoring contract (163).