Skip to content

Bug: credential executor registry disposal abandons its faulted shared completion task #1735

Open

Description

@JoshuaRowePhantom

Source-proven correction proposed; implementation not authorized here

Make the initiating CredentialAccessExecutorRegistry.DisposeAsync caller await the same disposal.Task that concurrent/repeated callers await, after publishing its result/failure. Do not both fault that TaskCompletionSource and throw through a separate async invocation without observing the stored task. Preserve all component aggregates, exact exception identity, asynchronous waiting, later executor cleanup, and exactly-once ownership. AccessBroker.DisposeAsync has the same first-caller pattern and needs the analogous completion-task ownership correction for single-caller failures; its completion task is observed by concurrent/repeated callers in this particular original test.

This is a production task-ownership defect, not a request to ignore global GC events in tunnel tests, weaken failure assertions, flatten aggregates, or add a catch-and-suppress observer. The original executor cleanup failure must still reach every DisposeAsync caller.

Exact original failure, observed during #1703 qualification

Exclusive checkout: C:\dev\Phantom.Workspaces-Skills\worktrees\fix-1703-1702-history-781a4a3a.
HEAD: 85b212b7bcf532f94f99955279214a86e7670c8e; incident baseline/merge-base: 8effbf34c751b7d67e07e55c3e4092cc5702340a.

Original Phantom.Workspaces.Tests\TestResults\jrowe_DAEMON_2026-11-13_13_47_57_net10.0.trx, SHA256 4A9A99EBBB6410B620EEAF8925E3ED51062BBE89F7CCE1EF7C9A4FF8A2ACEE40.

The original CredentialAccessExecutorRegistryTests.AccessBroker_DisposeAsync_ConcurrentAndRepeatedFailureStillCleansLaterExecutorsAndPolicy passed, ending 2026-11-13T14:24:12.8693642-08:00. At 14:24:32.6365148 the tunnel test ObserveForwardedConnectTransform_ForwarderConnectFaultsWithOperationAborted_IsConsumedAtSource started; it failed at 14:24:33.1638681 because its global UnobservedTaskException handler received:

AggregateException: A Task's exception(s) were not observed ...
  AggregateException: One or more credential executors could not be disposed.
    InvalidOperationException: Executor cleanup failed.
      CredentialAccessExecutorRegistryTests.<...ConcurrentAndRepeatedFailure...>b__0:47
      CredentialAccessExecutorRegistry.DisposeAsync:60,72
      AccessBroker.CleanupAsync:683

This is not an OperationAborted socket exception originating in the tunnel helper. The tunnel test's forced GC/finalizer drain merely exposes a task abandoned by the earlier cleanup test.

Mechanism and precise owner

  1. The test's first executor deliberately throws the exact executorFailure; the second executor succeeds. It invokes broker disposal initially, concurrently, and repeatedly, but never invokes executor-registry disposal a second time.
  2. Registry DisposeAsync:46-75 collects that leaf, faults its private disposal TCS at line 71, then throws the same registry aggregate at line 72. The first invocation's async ValueTask/task and the private TCS task are different tasks. Awaiting the invocation consumes only the former. Only repeat registry callers await the private TCS task (lines 48-51); none exist here.
  3. AccessBroker.CleanupAsync:679-689 observes the registry invocation and retains its aggregate while later policy cleanup runs. The broker's three external disposal invocations are all asserted/observed by the test. Those awaits do not observe the registry's private TCS task.
  4. The unobserved original event contains the registry aggregate, not the outer Access shutdown did not complete cleanly broker aggregate, identifying the unobserved completion task. Finalization occurs later in the tunnel test's global GC window.
  5. TunnelRelayDevTunnelHost.ObserveForwardedConnectTransform:308-328 accesses the completed transform's Exception in an ExecuteSynchronously/OnlyOnFaulted continuation. Its expected OperationAborted task is consumed there; the unrelated registry task is outside that helper's ownership.

Baseline independence / duplicate check

The mechanism-bearing Git blobs are identical at baseline and current HEAD:

  • CredentialAccessExecutorRegistry.cs: 9df52719212a4a7f3095ddfc1af0fedd79a49aa4.
  • AccessBroker.cs: 20ce43a899cd30d16d347adca756e582721ca212.
  • CredentialAccessExecutorRegistryTests.cs: c9a60571e83858883f4a67c92a72c627a87487a6.
  • TunnelRelayDevTunnelHost.cs: 0bfe24d0d5e380eb16e2975f8d74776e5548018f.

The injected executor failure and complete registry/broker disposal path do not call the changed startup-history/remote-projection code. This is positive task/exception-identity evidence of an existing fault, not subsystem-only attribution. Registry's faulting-TCS/throw pattern predates this branch; source/history inspected from this checkout contains no existing correction to that pattern.

Full #1652 body/comments were checked. Its already-landed f88a241a fixes only a nested-aggregate assertion; that assertion is correct and passes in this original. This distinct unobserved registry completion-task bug is not fixed by #1652 and should not reopen/relabel its assertion mismatch. Searches for registry/credential disposal and unobserved-completion issues found no matching existing bug.

Proposed minimal regression coverage

Retain the existing two CredentialAccessExecutorRegistryTests and all concurrent/repeated identity/later-cleanup assertions. Add owner-focused coverage for initial-only failed registry disposal and initial-only failed broker disposal: every published fault must be consumed through the shared completion task while still propagating the same original aggregate to the caller. Correlate any GC diagnostic to that owner's exact failure/task, rather than treating arbitrary global events as tunnel faults. Execute only the approved project-specific runner after an authorized source correction; no unchanged-test green reruns or stability loop are a diagnosis.

Evidence health and limits

Reopened/hash-audited all 21 exact original FAST TRXs from the runner's Results File lines: 10289 executed, 10287 passed, 2 failed. This original host finished normally with 4539 executed/4537 passed/2 failed, ResultSummary Failed, two assertion ErrorInfos/two matching Error RunInfos; all other emitted hosts are Completed. The second independent failure is split preparation/STOP, reported separately on #1703/#1722. No new relevant dump exists for either current assertion; eight retained historical Core dump paths are unchanged and do not diagnose these incidents. No dump/raw fixture/TRX was moved, deleted, rewritten, or relabeled.

No source edit, test rerun, build, commit, integration, ref move, push, closure, cleanup, delegation, other-worktree inspection or skills-root state write was performed. This is a source-proven diagnosis/proposed correction, not implementation or a FAST waiver. The original 5620 changed-class passes and 20 native million-row passes remain genuine scoped acceptance; the current mandatory FAST remains FAILED.

Activity

  1. added
    bug
    diagnosed
    verified-locally
    needs-slow-tests
    on Nov 13, 2026
  2. JoshuaRowePhantom commented on Nov 14, 2026

    @JoshuaRowePhantom
    OwnerAuthor

    Verification result

    Status: Verified locally for the exact initial-only shared disposal-completion defect. Both initiating registry/broker invocations now publish and await the same shared task as repeat callers. Event-gated owner-specific regressions inspect actual exception-holder observation before test cleanup, preserve exact nested original failure identity, later cleanup and exactly-once ownership. Existing concurrent/repeated disposal and complete selected tunnel/access classes passed; no GC-global filter or catch-and-suppress production observer was added.

    Outstanding gaps

    None in the issue-specific incremental scope qualified above.

    Independent immutable SHA: 5ae1efab4009d57723285e8e0172dfa31be63800, branch batch/1703-1702-history-performance, exclusive checkout C:\dev\Phantom.Workspaces-Skills\worktrees\fix-1703-1702-history-781a4a3a.
    Scoped comparison: 85b212b7..HEAD: 597eeaae shared registry/broker disposal completion; 5a473392 preparer STOP/cancellation/join/tracing, repository-operation and shared process-exit ownership; 5ae1efab durable native tree batching. Approved checkout-source succeeded before source inspection. Requirements, current source/diff and actual original XML determine this verdict, not implementation handoffs.

    Fresh independent tests and original health

    Only approved project-specific run-tests.ps1 -NoBuild -Mode full was used. Every executing Main, ProcessAcceptance, Offline, Core and native WebView test assembly was independently identified as ProductVersion 0.0.1+5ae1efab4009d57723285e8e0172dfa31be63800. No fresh build was necessary to establish identity. NuGet auditing was not disabled; no dependencies or machine configuration changed.

    Fresh scope Executed/passed/failed Exact original beneath the corresponding project's TestResults
    Main targeted access/ownership/protocol union, including actual controlled split cancellation 3/3; NOT the entire ProcessIsolated class 173/173/0 jrowe_DAEMON_2026-11-13_16_06_04_net10.0.trx
    Complete affected native storage selection 149/149/0 jrowe_DAEMON_2026-11-13_16_11_35_net10.0.trx
    Whole SchemaPopulatorTests 38/38/0 jrowe_DAEMON_2026-11-13_16_34_03_net10.0.trx
    Actual unchanged native exact-million acceptance, both workloads 2/2/0 jrowe_DAEMON_2026-11-13_16_34_45_net10.0.trx

    362/362 passing executions, four fresh Completed original hosts. Independently reopened all counters/results/ErrorInfos/Error RunInfos/attachment nodes: all unhealthy counters zero, no ErrorInfo, Error RunInfo, attachments or fresh abort/dump references. All runner receipts exited 0. Full original paths/SHA256/health: scripts\independent-fresh-originals-health.json.log; exact runner outputs: scripts\independent-{main,storage,schema,million}-5ae1efab.log.

    Storage selector: GitTreeWriteBatchTests,GitDataAccessLayer,FilesystemDataAccessLayerTests,FilesystemSnapshotPublicationTests,RepositorySnapshotLockTests; schema selector: SchemaPopulatorTests; native selector: SessionHistoryLoadAcceptanceTests. Full main method/class selector and exact commands are retained in scripts\independent-5ae1efab-verification-handoff.log. This is targeted FULL mode, not broad FULL, a new stability gate, the mandatory all-changed-class union, or broad FAST.

    Actual cold and native performance boundaries

    The three actual production controlled cases passed their unchanged PREPARED90s/STOP10s guards, plus actual process exit/pipe cleanup. GUI-disposal: preparation 56.450s/schema34.621s/native schema commit2.516s; retry:57.806s/35.732s/2.716s; attach:79.821s/58.450s/3.247s. These are nested child stage durations, not additive or invented end-to-end parent timings. The observed attach margin is narrower than the earlier implementation run; no arbitrary-load or historical OS/filter/clone-cause guarantee is claimed.

    Read-only verification of the three newly exercised real Git repositories: each has 1,402 indexed paths (744 prefix markers,261 exact-name markers,196 metadata files plus payload/relationship/revision files), one verified standard pack containing2496/2497 trees and zero packed blobs/commits. Post-scenario private/published revisions match203/205, with10/12 commits. No snapshot cache/clone dependency or MSYS assumption was introduced. Evidence: scripts\independent-current-cold-stage-evidence.json.log and scripts\independent-current-real-fixture-proof.json.log, including fixture-origin qualifications.

    Fresh native exact1,000,000 logical messages: prose 6596.477ms, tools 12583.799ms; exactly1,000,000 metadata visits and200 models each. Original strict <30000ms, full-history first/middle/last navigation/search/selection and tool-owner readback remain. Timer includes actual production-control/native-shell bootstrap, store read/conversion/owner publication, retirement/settlement, ready handoff, HTML/bridge/native DOM application and accessibility. Only raw fixture/store seed is excluded (1921.207ms/2144.647ms); existing application/platform fixture is initialized and store is the existing in-memory backend, not external database/network latency. Test-host working sets1181122560/1693806592 bytes exclude browser subprocess totals;200 models is not an individual-payload byte cap.

    Preserved failures and separate parent qualification

    Independently reopened all21 exact original FAST TRXs:20 Completed/one Failed,10289 executed/10287 passed/2 failed; the failed host is4539/4537/2 with two ErrorInfos/two Error RunInfos. Original failed SHA256 remains 4A9A99EBBB6410B620EEAF8925E3ED51062BBE89F7CCE1EF7C9A4FF8A2ACEE40. That original FAST remains FAILED. Independently reopened/hash-matched all15 prior bootstrap originals:413 passing executions, all Completed; those are historical, not relabeled as this independent362-case run. Evidence: scripts\independent-preserved-originals-health.json.log.

    All old/new originals, dumps and raw fixtures are preserved. No source edits, commit/ref movement/push/closure, cleanup, delegation/agent messages, other-worktree build, root-state write, deadline inflation, GC/tunnel filter, prerequisite waiver, task-fault suppression or direct/custom test loop was performed. Source/index/untracked status remains clean. Parent owns later complete changed-class qualification, separate fresh FAST/FULL requirements, checkin/push and remote gate; none is supplied by these targeted passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdiagnosedneeds-slow-testsverified-locally

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions