Skip to content

P5 O5 fix: a forwarded request's end restarts the park clock before the zero count - #443

Merged
SSFSKIM merged 1 commit into
masterfrom
p5-fix-park-order
Nov 2, 2026
Merged

SSFSKIM merged 1 commit into
masterfrom
p5-fix-park-order

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 2, 2026

Copy link
Copy Markdown
Owner

What was wrong

engineRequests().forward (src/mawsd/engine-requests.ts) publishes the in-flight count's drop to zero (clocks.engineRequests(0)) and tells no need at the request's end. When a forwarded request runs longer than idleExitMs (a connectors.call of up to 180 s, say), that zero count's DaemonClocks.evaluate() reads the park clock started at the request's start, finds it overdue, and arms the park the moment the request ends. The engine host parks right after a long request instead of after a fresh idle window, and the next request pays a cold start.

The fix

The request's end tells the need first (clocks.engineNeeded(), which restarts parkSince), then publishes the count. The count's evaluation then reads the clock started at the end and asks nothing. This is the order p5-o7-m5b (d809057) gave the document hold's release; the hold itself is untouched here and lives on that branch. Both files merge cleanly with p5-o7-m5b (git merge-file against this head): the new test sits after the first case, away from that branch's insertions.

Side effect, in line with the need's documented terms: a discovery wake's park still to be asked when a request ends is left to the clock, as for any need.

Red before the fix

src/mawsd/engine-requests.test.ts, "on the real clocks, a request that outlives the idle time asks no park as it ends, and the idle time runs again from there (P5 O5)". It drives the real DaemonClocks (idle 1 s) under fake timers: a forwarded request held 5 s, then answered.

Without the source change:

FAIL  … on the real clocks, a request that outlives the idle time asks no park as it ends, and the idle time runs again from there (P5 O5)
AssertionError: none as it ends: expected [ 'idle' ] to deeply equal []
Tests  1 failed | 6 passed (7)

With it, 7/7 pass. The test asserts no park at the end, none at 999 ms after, and idle at 1000 ms.

Gates

All runs are on head 3500cb5, tree c8b999d8b (each run's tree checked equal to the head's).

  • Class 1a (static, unit, probes; pool): 41430316584 is green, 0 flaky lines.
  • All (macOS lane, the mini's hold lifted): 41431471621 is red on e2e:discover alone, with 1 flaky line. Every other job is green.
    • e2e:discover: e2e/discover.spec.ts:584 missed the 'legal' search's "13 results" heading within 5 s; the page still showed the grid's placeholders (heading "All", 4 items). This is the tracker row "e2e:discover (catalog-backed assertions)", same case, same signature. Nothing here is on the catalog path, and with an app attached the park clock arms nothing (parkDue() is null).
    • The rerun of the group on the same tree, 41444935390, is green with 0 flaky lines.
    • The flaky line: e2e/maws-tools.spec.ts:218 (the sidebar hover card didn't show within its 10 s toPass at one window size, on an EC2 overflow Mac) passed on retry in 4.2 s. That is renderer hover timing, out of this diff's reach for the same reason.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)

…ount, so the count's evaluation reads the clock started at the end and asks no park on the one from its start; a request that outlived idleExitMs (a connectors.call of up to 180 s) no longer has the engine host parked the moment it ends; proved on the real DaemonClocks

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@SSFSKIM
SSFSKIM merged commit 338ddbd into master Nov 2, 2026
SSFSKIM added a commit that referenced this pull request Nov 2, 2026
…he park order, the catch-up restart, O16's render reading); shape B's row 2 closed, the hosted row's signature (23), the discover family tallied

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 2, 2026
…o p5-o17

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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.

1 participant