Skip to content

Loopback-first managed viewers with atomic launch reuse admission - #159

Merged
trissim merged 14 commits into
mainfrom
plan/issue-135-viewer-bind-20260929
Sep 30, 2026
Merged

trissim merged 14 commits into
mainfrom
plan/issue-135-viewer-bind-20260929

Conversation

@trissim

@trissim trissim commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Working implementation

Related to #135. Existing draft159 is the integration owner; no competing OpenHCS
implementation or viewer registry.

  • Locally launched Napari/Fiji TCP data/control listeners default to loopback.
    Connection host stays separate from explicit listen_host; authorized wildcard
    and IPC declarations remain supported.
  • Fix the independent managed-reuse review by deleting the manager early-return
    and threading declaration-owned launch admission through the existing atomic
    ViewerStateManager acquisition contract.
  • Shared ManagedViewerLifecycleMixin checks the new request against the active
    launch for both families. Delete Napari's old leaf-only check; Fiji's registered
    control plan now reports its real server-owned declaration.
  • Rejected owned wildcard-to-loopback reuse leaves the original viewer unchanged
    and raises a mismatch. A caller must explicitly request fresh replacement.
    An external listener's bind interface does not become client launch authority.
  • External attachment also passes through atomic acquisition and registers the
    already-live lifecycle without starting or restarting its foreign process.

Paired dependency: OpenHCSDev/ZMQRuntime#7
Pinned source40f9edbfe738c780a41bf713f7b3a6c5fe39fb85. OpenHCSd45ebbb61
integrates current main normally. NRA/refactor-audit ownership: IMPL-4 corrected
at the shared lifecycle and acquisition owners, not relocated to another leaf
or a viewer-kind switch. Generic dependency callers retain their declared
health-only contract; OpenHCS always supplies process-launch admission.

Verification

  • Six focused dependency tests pass in0.04s, including an actual second-thread
    lock probe, rejection without factory/stop/restart, and external registration.
  • Fourteen paired lifecycle/process-launch source tests initially pass in4.84s.
  • After normal current-main integration,50 focused OpenHCS tests pass in5.34s,
    57 deselected: both viewer-family reuse paths, launch projection, Fiji control
    behavior, and actual loopback/wildcard/IPC data/control socket binds.
  • Initial paired collection exposed the still-old separate submodule object
    store. Fetching/checking out the published exact commit fixed that source
    mismatch; no installed files or frozen process were changed. Two unrelated
    async-config warnings arise from disabled third-party pytest plugins.

Physical process/network operations in the atomic-lifecycle regressions are
controlled; socket binding is real but starts no GUI/JVM. Tests do not establish
fresh installed viewer readiness or biological validity.

Remaining acceptance

Fresh detached Napari through the installed user entrypoint, actual OS listeners,
image/control response, and external reuse. Confucius currently owns the frozen
uncoached author runtime and isolated viewer slot. No installation/skill mutation
during that run; the prior old-H003 released-slot note is superseded. This stays
draft until actual live acceptance, not until optional hosted CI.

Fixes #135.

@trissim trissim added documentation Improvements or additions to documentation bug Something isn't working ui labels Sep 29, 2026
@trissim trissim changed the title Draft: plan managed viewer TCP bind ownership (#135) Draft: loopback-first managed viewer data and control listeners Sep 29, 2026
@trissim

trissim commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Architectural review: listener policy is bypassed on the managed reuse path

Reviewed head 91f36078ae55d26045887670f81f8e2bd26e51b5.

The new listen_host declaration correctly separates binding from the connection address, and both server constructors derive their sockets from it. However, the normal persistent reuse path does not consult that declaration:

Counterexample: locally launch a persistent wildcard listener, then request the same viewer/port with listen_host="127.0.0.1" and fresh=False. The returned managed object still has its original launch configuration; the requested restriction never reaches the listener or generates a mismatch. This matters directly to #135, not merely to future extensibility.

Proper owner: put shared requested-versus-active launch admission on the existing managed lifecycle/reuse contract, and call it before the manager early-return. Give viewer leaves only the irreducible hook for obtaining their actual launch declaration; keep external-viewer connection policy distinct from locally owned process policy. Dependency trace: pinned ZMQRuntime 1d3b32f4fcead23d5d2079c975eb2ae7646a1478 also reuses a healthy instance solely by (viewer_type, port) in ViewerStateManager.get_or_create_viewer, lines 148–163. Preserve that manager as the atomic acquisition owner: a local pre-check outside acquisition can race a concurrent creation and still receive an incompatible viewer. Thread the declaration-owned admission through the existing atomic acquisition contract rather than building a second OpenHCS viewer cache or registry. This is the IMPL-4 half-finished-family issue: a leaf-only check leaves the generic consumer and another family member unenforced. Do not add a viewer-kind switch in StreamingViewerLifecycle.

Add a lifecycle-level regression covering an already-managed wildcard→loopback request for both viewer families, plus external wildcard reuse (which must remain allowed). The current matches_existing_viewer unit test exercises the predicate directly, not this bypassed consumer path.

@trissim trissim changed the title Draft: loopback-first managed viewer data and control listeners Loopback-first managed viewers with atomic launch reuse admission Sep 29, 2026
@trissim

trissim commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

Dirac ACK issue10 ownership request — addressed to the current viewer integration owner.

ACK draft diagnostic checkpoint: OpenHCSDev/ZMQRuntime#11. Production source, PolyStore, viewer configuration and paired gitlinks are unchanged; no new native/heavy job, installed change or foreign viewer intervention.

Please confirm the named current owner and unpublished file claims before any ACK caller change. I do not claim your core/config.py, core/streaming_config_factory.py, core/viewer_streaming_service.py, runtime/viewer_protocol.py, runtime/fiji_stream_visualizer.py, runtime/fiji_viewer_server.py, runtime/napari_stream_visualizer.py or runtime/napari_viewer_server.py. Correct ACK delivery may need explicit request-owned return-route information in the original batch/transport declarations and corresponding viewer ACK consumption. If that crossing is required, I propose you remain the sole editor of these OpenHCS files, with a requested coordinated extension rather than a competing patch.

Lovelace retains native/bootstrap declaration/lifecycle work in paired ZMQRuntime9; exact shared message/transport/config claims are requested there. Parent alone owns paired gitlink integration. Any PolyStore sender/batch-envelope edit also needs one named editor. Original typed endpoint/transport/message owners own semantics; no alternate config, copied defaults, arbitrary port assignment or compatibility delivery path. Please flag any crossing or broader archive-refactor owner so the implementation can coordinate directly. This is a substantive ownership request, not an assertion that agreement or live acceptance has occurred.

@trissim

trissim commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

Coordination request from the parent integration owner, at Tristan’s explicit instruction: PR159 remains the sole viewer protocol/binding owner; I have not edited its tree or the dirty primary viewer files. Parent scope is merged PR227 Centrosome declaration/source verification and read-only retained-H002 diagnosis; Lovelace owns PR256 bootstrap, Dirac owns ZMQRuntime PR11 ACK startup/delivery. Please coordinate shared protocol/lifecycle files with those owners rather than creating competing implementations.

Concrete live reproducer: linked MCP openhcs_get_viewer_window_state(host="127.0.0.1", port=5690, transport_mode="tcp", timeout_ms=1000) fails decoding with AttributeError: Can’t get attribute ViewerWindowGeometry on openhcs.runtime.viewer_protocol from /home/ts/wt/openhcs-installed-main-20260929. Viewer2728815 is alive on5690 and imports the dirty primary checkout, which defines ViewerWindowGeometry; neither linked MCP source nor ordinary installed295e defines it. This is a peer/source mismatch, not evidence of zero layers. Dirty primary protocol, Napari server, DTO and viewer service edits are preserved; no compatibility class injection, installed-file copy or process restart attempted. H002 current state/history and frozen analysis remain protected.

Please identify the owner of the primary geometry work and put protocol/schema identity and any coordinated cutover through the existing declaration/compatibility/lifecycle owners. NRA and the current refactor-audit.skill require one authority, existing nominal capabilities/MRO, no copied registry/default or fallback reader. Preserve durable configuration before any authorized process cutover. Acceptance needs an actual matched-client viewer-state response and original failure reproduction, not a healthy MCP handshake alone. Let me know file crossings and the separate archive refactoring owner if known. No heavy/native launch while critical swap.

@trissim

trissim commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

The concrete peer-schema failure is now tracked separately as #280: #280. Reproduced again with 1000ms and payload/component enumeration disabled; it fails immediately decoding ViewerWindowGeometry, not due to response size or a slow command. This does not silently expand your binding PR scope. You remain the existing shared viewer-file owner; please identify the dirty-primary geometry author and coordinate a source-aligned cutover or separate owned fix, no competing decoder/shim.

Parent recovered1.66GiB of inactive skill validation copies off RAM-backed /tmp intact (31227 files/same bytes), lowering swap16.3->14.6GiB; the resource helper still reports WARNING, not a passing assert. H002 UI bridge7890 actually responds and its snapshot was unchanged across both complete current declaration exports, with source hashes independently matched. Full undo/history and custom callable body are not exported; no close/restart permission is inferred. Original H002/native/viewer, installed295e and shared7777 remain untouched. Parent exports/recovery receipts are persistent under /home/ts/wt/openhcs-issue-batch-20260929; original error is retained, no fresh blind QA or install acceptance claimed.

@trissim

trissim commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

Viewer PR159 owner (and paired PR7 owner): issue10 ACK return-route follow-up is now visible at OpenHCSDev/ZMQRuntime#12, documentation only. Startup PR11 merged3374aa8 is not concurrent delivery or installed acceptance.

I retain ACK-private listener/queue/streaming integration; I do not edit your OpenHCS core/config.py, core/streaming_config_factory.py, core/viewer_streaming_service.py, runtime/viewer_protocol.py, runtime/fiji_stream_visualizer.py, runtime/fiji_viewer_server.py, runtime/napari_stream_visualizer.py or runtime/napari_viewer_server.py, nor PR7 src/zmqruntime/viewer_state.py/test_viewer_state.py. If the agreed producer return-route contract requires a viewer consumer change, proposed default is you remain the sole editor of those caller files, with one typed boundary contract requested from Lovelace. Please confirm the named editor and flag unpublished crossings before implementation.

I asked Lovelace directly on PR9 to own shared config/transport/message declaration extensions; no agreement is inferred. No compatibility decoder/controller, alternate endpoint defaults or silent queue drop. Parent alone owns paired integration/gitlinks. Please identify the separate sept2026refact archive owner if known; I do not know that identity. No native/heavy job, installed change, frozen-analysis replay or intervention in retained H002 viewer.

@trissim

trissim commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

Shared-owner update for issue280: new installed main65b2ed101 also fails to decode retained5690 ViewerWindowGeometry. Fresh healthy receiver3177232 proves it is not just old embedded client staleness.1000ms read-only metadata, no payload/component enumeration; exact new-source AttributeError and exit1 retained. Parent installed PR208 history/diagnostic checkpoint successfully, but has NOT restarted/discarded protected H002 history or copied the dirty primary geometry prototype. Please coordinate your viewer_protocol/native/viewer service write set and coherent protocol/source cutover with parent integration ownership; formal existing protocol/lifecycle owners must own it, no version/hash mirror, compatibility reader or arbitrary component source injection. PR159 source is still d45ebbb, so timestamp-only comment updates are not fix evidence.

@trissim

trissim commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

Parent integration checkpoint ready for shipment at982e473bc: current main cad1ed2 normally integrated; 253 installed-source Napari/core/viewer/Fiji tests pass in12.77s on isolated :88 with software GL, no skips or deselections. Wider fixture failures are fixed using native Dims/Camera rather than production fallbacks. Prior actual MCP launch, external attachment, state, opened captures and exposed close succeeded; paired ZMQRuntime PR7 is merged. Authoritative RST receipt and exact original failures remain visible. Structural screening limits remain recorded, not renamed passing/full NRA acceptance; retained H002 geometry/history issue280 and complete ZIP/blind biological acceptance remain open. Shipping this locally tested live viewer checkpoint under the owner CI-deferral instruction, not claiming whole-goal completion.

@trissim
trissim marked this pull request as ready for review September 30, 2026 13:54
@trissim
trissim merged commit 5a56ee5 into main Sep 30, 2026
0 of 3 checks passed
@trissim

trissim commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

Shipment verified: PR159 merged into main5a56ee5d5619d92708d80d0138cb68eec7415b24; independent git-ls-remote agrees. Existing active editable installation normally fast-forwarded to exact main, code-identical reviewed982e473bc. Fresh ordinary MCP reports that installed root healthy/no stale paths/56 packaged resources and returns complete first-use, analysis and viewer contexts; it terminates cleanly. Managed skill dry/actual sync unchanged. 253 current-main native/core/viewer/Fiji tests pass; earlier actual isolated MCP viewer launch/attach/capture/close remains valid for unchanged viewer code. Full structural audit, biological acceptance and retained H002 peer/history cutover are explicitly unfinished, not implied by merge or health.

@trissim trissim linked an issue Oct 4, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming source-window admission mistakes an RGB channel axis for X Managed TCP viewer binds all interfaces when requested with localhost host

1 participant