Skip to content

A dispatch HOLD must name a human owner and an expiry — and must not be ambient state #42

Description

@thegeorgepu

A control file that halts other sessions' work froze a worker queue for hours today. Nobody could say who placed it or why, and the justification named an authority that does not exist.

What happened

scratchpad/endurance/HOLD, written 2026-08-29T23:53:46Z:

hold requested 2026-08-29T23:53:46Z
reason: Mission Alpha queue governor: freeze dispatch while authoritative
        inventory and admission policy are established

A matching GLOBAL_HOLD_PATH check was added to may_dispatch() in endurance.py.

Consequences, all real:

  • A worker session stopped dispatching and waited, with two finished task types queued behind it.
  • It attributed the hold to a peer session, which had never touched the harness — so it waited on someone who could not have lifted it and did not know it was blocked.
  • "Mission Alpha" appears nowhere else on disk. Grepping the entire scratchpad returns exactly one hit: the HOLD file itself. There is no plan, no inventory doc, no admission policy.
  • Asked directly, the person it would have to have come from did not recognise the name.

The freeze may well have had a real technical concern behind it. That is not the problem. The problem is that nothing in the mechanism required it to be attributable, so a legitimate concern and an invented one are indistinguishable from the outside — and the only safe reading of an unattributable freeze is to honour it, which is what happened, for hours.

Ask 1 — a hold must name a person and an expiry

Make may_dispatch() refuse a hold that does not carry:

  • owner: — a human, not a codename. "Mission Alpha queue governor" must not satisfy this.
  • reason: — what would have to become true for it to lift.
  • expires: — a timestamp. An expired hold is ignored and logged, so a forgotten one self-clears.

A hold missing any of these should be logged loudly and NOT honoured. That inverts the current failure mode: today an unattributable hold silently stops everything, when it is precisely the one that has earned the least deference.

Ask 2 — the hold path is ambient state, and it breaks the test suite

may_dispatch() reads GLOBAL_HOLD_PATH = os.path.join(HERE, "HOLD") — filesystem state next to the module. The harness's own unit tests construct a Dispatcher and call tick(), so with any hold present every one of them dispatches nothing.

Measured:

python3 -B -m pytest -q tests/   ->  14 failed, 8 passed
d.may_dispatch()                 ->  'controller-wide HOLD file present'
# same fixture, GLOBAL_HOLD_PATH redirected to a nonexistent path:
d2.tick(); len(d2.state["tasks"])  ->  1

Bisected: green with the hold feature reverted, green with the feature and no hold present, red only when a hold exists. The failures surface as StopIteration deep in unrelated stop-rule tests rather than "dispatch is held", so the suite lies about what is wrong.

Fix: make the hold path an explicit constructor argument the Dispatcher takes, so tests pass a temp dir. Relocating the default is not enough — the point is that a test's result must not depend on ambient state no test set.

Credit for the measurement and bisection to the session that found it while blocked.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions