Skip to content

Bug: engine-toggle-throwing-log-sink-leaves-stale-prime-marker #947

Description

@drmoisan
  • Work Mode: minor-audit

Summary

After #942 moved CompletePrime to report the fault first and clear the marker second, a logError sink that throws skips the _primeTasks.TryRemove. The stale prime marker then blocks later re-primes for that engine, which is the #944 symptom by a different cause, and the continuation task faults unobserved.

Environment

  • OS/version: Windows 11 / windows-latest
  • Python version: n/a (C#, .NET Framework 4.8)
  • Command/flags used: n/a
  • Data source or fixture: TaskMaster/Ribbon/EngineToggleStateCoordinator.cs, CompletePrime

Steps to Reproduce

  1. Construct the coordinator with a logError delegate that throws.
  2. Fault a prime, so that EngineActiveAsync faults.
  3. Call GetPressed again for the same engine.

Expected Behavior

The marker is cleared whether or not the log sink throws, a later GetPressed starts a new prime, and no task faults unobserved.

Actual Behavior

The marker stays registered, no re-prime starts, and the continuation task faults unobserved.

Logs / Screenshots

Impact / Severity

  • Blocker
  • High
  • Medium
  • Low

Source

From: docs/features/potential/2026-09-30-engine-toggle-throwing-log-sink-leaves-stale-prime-marker.md

Activity

  1. drmoisan commented on Sep 30, 2026

    @drmoisan
    OwnerAuthor

    Restoring sections dropped by the promotion tooling.

    Suspected Cause / Notes

    The report-then-clear ordering introduced by #942 puts _logError before _primeTasks.TryRemove in CompletePrime, with no try/finally, so a throwing sink skips the removal. The production sink is logger.Error, so the likelihood is low. Source: #944 spec, Rollout and Follow-up item 1.

    Proposed Fix / Validation Ideas

  2. drmoisan commented on Oct 1, 2026

    @drmoisan
    OwnerAuthor

    Same root cause, second call site, found during #947 preparation and consolidated here instead of filed separately.

    HandleToggleClickAsync in TaskMaster/Ribbon/EngineToggleStateCoordinator.cs calls _logError without a guard (line ~184). A sink that throws can therefore escape a method documented as never throwing.

    The fix for #947 should cover both sites: CompletePrime and HandleToggleClickAsync. Each site needs its own regression test using a throwing sink.

  3. drmoisan commented on Oct 1, 2026

    @drmoisan
    OwnerAuthor

    Delivered by PR 963 (#963, merge commit f5b46df), parallel run bugs-2026-09-28. Both call sites (CompletePrime and HandleToggleClickAsync) contain a throwing log sink; all seven checks green on head b8367b3 (run 36935916454) before merge. Follow-ups are filed separately by the run coordinator.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions