Skip to content

Retire held backends and join original session observations - #3828

Merged
trissim merged 2 commits into
mainfrom
pi-commander-config-retirement
Nov 1, 2026
Merged

trissim merged 2 commits into
mainfrom
pi-commander-config-retirement

Conversation

@trissim

@trissim trissim commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

One lifecycle repair, 2 commits, 6 files, +189/-44. Final bounded controls: 11 passed in 2.81s, exit 0. No full suite, local NRA gate, paid model, failed-root replay, migration or installed-package edit.

Cleanup no longer manufactures a backend. Configuration and shared-root goal observations now borrow the original OwnerSession through owner-held completion joins, instead of resolving a session ID after that session was removed. Independent observations remain parallel.

Failure and owners

The preserved configured-fork attempt failed during attachment because its wrapper re-entered in a spawned process. That wrapper defect is separate from these two Core failures recorded in the same private owner log:

  1. SessionConfigOptions._observe_configuration:219 -> SessionLifecycle.sync_identity:385 -> TurnRunner.close_idle_backend:395 -> idle_backend:415 -> backend_for:186 -> PiNativeBackend.for_worker:214 -> DrainedSession.owned:606: cleanup attempted backend acquisition without local execution.
  2. InputObservation.observe_root:256 -> GoalScheduler.observe_root:275 -> SessionLifecycle.require:143: a captured observation used an already removed session ID.

Original evidence stays immutable at pi-toad-errors/configured-fork-image-1; zero tracked input IDs was not promoted into a no-effects claim.

Before / after

Backend retirement

Before: TurnRunner.idle_backend selected/created a backend, borrowed its concrete .lock, and called .close(). That was native-specific behavior beside the declared family contract.

After: TurnRunner.close_idle_backend reads only persistent_backends, keeps the turn exclusion, and dispatches AgentBackend.close_idle(). Native inherits PersistentPiSession.close_idle; durable supplies PiDurableBackend.close_idle. Each implementation owns its child lock and closure. The unused acquisition context manager and both consumers' unnecessary Thread argument are deleted; there is no compatibility alias.

IMPL-4: fact: backend retirement behavior; at: old turn_runner.py:394-417; derive: base-method; by: agent_backend.py:278, implemented at pi_native_backend.py:180 and pi_durable_backend.py:239. Paper1 Theorems 4.6/4.7 explain why a consumer-side route is still outside supply.

Observation lifetime

OwnerSession already owns the original stop future. Its new observe_live admits an observation only while that stop remains unset and retains one completion for the admitted operation. Retirement closes admission, retires transport/input producers, then joins those completions before closing backends or dropping session state. Work captured before retirement but admitted afterward performs no observation. Cancellation completes its admitted operation in the same finally block; independent readers do not share a mutex.

The initial a5b checkpoint used the retirement lock around observation. Source review caught that unnecessary serialization before merge. The second commit replaces it with owner-held completions; the control requires two independent observations to enter together before either is released, then checks real fenced retirement waits for both. The old checkpoint is not the qualified head.

Configuration membership retains those original owner objects, replacing the ID-only set. Both initial menus and registry-driven refresh use the same owner method. Shared-root goal publication carries OwnerSession, and source decoding occurs inside admission—not before it. Goal refresh tasks remain independent of inbox waking; failures still reach RuntimeServer's original logger.

This preserves the required distinction between an original owner and an ID which could later be missing or rebound (paper1 Theorem 4.8; paper4 Theorem 2.6). No new stop flag, session mirror, empty-queue fallback, swallowed exception or retry mechanism is introduced.

Source evidence

NRA's existing parser and ModuleSyntaxIndex covered Core and Toad src/tests/tools: 1,885 parsed modules, zero parse omissions, 38 selected modules, 5,613 original sites in the before map. The publication map has 5,747 sites; its 37 selected Core module hashes matched the committed sources. The sole selected Toad module belongs to the original 4dfab029 snapshot, not the later #1393 review checkout. Original coordinates, declarations, imports, decisions, writes and consumer sites are retained in the owned source-map artifacts. Dynamic attribute binding and runtime mutation remain OPEN; syntax is not a behavioral proof.

The first driver invocation used an installed NRA version lacking module_syntax_index and exited 1. It was corrected by selecting the actual NRA source already read; no installed dependency was edited. The one-shot driver is removed before publication.

Interpreter readback confirmed actual native MRO resolution to PersistentPiSession.close_idle and durable resolution to its own close_idle. Six changed Python files compile. Whole-tree search found no remaining idle_backend() or _publication_sessions consumers.

Behavior evidence

Final command (existing host TestLease; borrowed dependencies read-only; explicit allocated Core src/tools/tests):

timeout -s INT 300 "$PYTHON" -m pytest -q -p no:xdist \
  -o faulthandler_timeout=60 --basetemp="$FRESH_OWNED_BASE" \
  tests/test_goal_publication_sources.py \
  tests/test_agent_backend.py::test_runner_obtains_one_backend_per_session_from_the_thread_declaration

11 passed / 2.81s / rc0 on the corrected parallel-reader head. Earlier selections passed 11/11 in 2.71s and 2.82s but did not establish preserved parallelism. The final selection covers concurrent admitted readers, fenced retirement, and source decoding inside admission, including a source document no longer containing the retired owner.

Actual private bus, registry, ACP owner, goal consumers and fenced retirement are used. Controls establish: no unloaded-session/backend acquisition during cleanup; a controlled real child is retained while a turn is held and retired through the durable backend contract when idle; admitted observation finishes before real owner retirement; captured configuration/goal sources cannot recreate state afterward; a queued initial menu respects the original stop; cancelled observation completes its retained admission; unchanged-goal source routing and original failure reporting survive.

Artifacts: owned heartbeat-publication/config-lifetime-{controls-1,controls-2,controls-3,source-proof,map-source,map-publish,parallel-reproof,parallel-publish}.*. The parallel correction uses targeted NRA reproof of its three changed modules, zero omissions; the other source-map bindings remain retained at a5b..

Acceptance still owed

This is source and private application-owner evidence, not installed or configured-provider fork/image acceptance. Preserve the original failed attempt. The independent Toad pager cleanup repair remains on Toad #1393 with its existing author; its exact-head lifecycle controls are a separate process/lease selection. Mobile/physical acceptance and the complete shared-work overhaul #3824 remain open and are not claimed here.

Assumed: no arbitrary runtime mutation beyond the traced backend/owner declarations; retired observations may be discarded, but admitted observations must finish before state removal. No change to routing, input dispositions, UNKNOWN handling, drafts or historical coordinates.

Copilot AI balanced review requested due to automatic review settings November 1, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

debt-src at c0f4081, every finding:

+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-br1fy3zj --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/agent-comms
= 16.693s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-br1fy3zj --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/agent-comms (16.693s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-88vkmzum --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/formbridge
= 1.169s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-88vkmzum --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/formbridge (1.169s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-3o3x60r5 --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/metaclass-registry
= 1.080s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-3o3x60r5 --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/metaclass-registry (1.080s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-7t8mws9t --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/textual
= 1.914s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-7t8mws9t --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/textual (1.914s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-99t_who7 --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/toad
= 1.217s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-99t_who7 --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/toad (1.217s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-d8ctk0zw --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/ui-theme
= 0.842s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-d8ctk0zw --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/base/openhcsdev/ui-theme (0.842s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-txkakf8n --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/agent-comms
= 17.516s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-txkakf8n --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/agent-comms (17.516s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-9fq9hor8 --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/formbridge
= 1.172s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-9fq9hor8 --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/formbridge (1.172s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-y76f3wkv --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/metaclass-registry
= 1.198s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-y76f3wkv --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/metaclass-registry (1.198s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-px0zqzvw --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/textual
= 1.967s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-px0zqzvw --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/textual (1.967s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-hnb_jbzn --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/toad
= 1.098s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-hnb_jbzn --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/toad (1.098s elapsed)
+ CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-zf62zjav --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/ui-theme
= 0.846s CommandPhase: /home/runner/work/_temp/checker-venv/bin/uv build --wheel --out-dir /home/runner/work/_temp/paired-sources/metadata/metadata-zf62zjav --python /home/runner/work/_temp/checker-venv/bin/python /home/runner/work/_temp/paired-sources/head/openhcsdev/ui-theme (0.846s elapsed)
grew BannedVocabulary:src/agent_comms/goal_scheduler.py +2
grew BannedVocabulary:src/agent_comms/input_drain.py +3
grew BannedVocabulary:src/agent_comms/session_config_options.py +1
::warning file=src/agent_comms/session_config_options.py::LintFindings +1 (warns, never blocks)
grew TypeCheckingImport:src/agent_comms/goal_scheduler.py +1
grew TypeCheckingImport:src/agent_comms/session_config_options.py +1
found BannedVocabulary:src/agent_comms/goal_scheduler.py at src/agent_comms/goal_scheduler.py:270 src/agent_comms/goal_scheduler.py:280
found BannedVocabulary:src/agent_comms/input_drain.py at src/agent_comms/input_drain.py:757 src/agent_comms/input_drain.py:759 src/agent_comms/input_drain.py:774
found BannedVocabulary:src/agent_comms/session_config_options.py at src/agent_comms/session_config_options.py:224
found LintFindings:src/agent_comms/session_config_options.py at src/agent_comms/session_config_options.py:173 (E501 Line too long (103 > 100))
found TypeCheckingImport:src/agent_comms/goal_scheduler.py at src/agent_comms/goal_scheduler.py:42 src/agent_comms/goal_scheduler.py:43 src/agent_comms/goal_scheduler.py:44 src/agent_comms/goal_scheduler.py:44 src/agent_comms/goal_scheduler.py:45 src/agent_comms/goal_scheduler.py:46
found TypeCheckingImport:src/agent_comms/session_config_options.py at src/agent_comms/session_config_options.py:29 src/agent_comms/session_config_options.py:30 src/agent_comms/session_config_options.py:31 src/agent_comms/session_config_options.py:32 src/agent_comms/session_config_options.py:33 src/agent_comms/session_config_options.py:34 src/agent_comms/session_config_options.py:35 src/agent_comms/session_config_options.py:36 src/agent_comms/session_config_options.py:37
introduced BannedVocabulary:src/agent_comms/goal_scheduler.py at lines [270, 280]
introduced BannedVocabulary:src/agent_comms/input_drain.py at lines [757, 759, 774]
introduced BannedVocabulary:src/agent_comms/session_config_options.py at lines [224]
introduced NoneAbsence:src/agent_comms/turn_runner.py at lines [402]

@trissim
trissim merged commit a15014f into main Nov 1, 2026
8 of 10 checks passed
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.

2 participants