Skip to content

Make clock-sensitive checks wait for completed work - #1707

Merged
max-sixty merged 3 commits into
mainfrom
codex/hosted-publication-diagnostics
Oct 4, 2026
Merged

max-sixty merged 3 commits into
mainfrom
codex/hosted-publication-diagnostics

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The browser health watchers could reject legitimate input work when it completed more slowly, or declare success before delayed paint was judged. Process race checks could pass before the competing process reached its lock. This completes the clock remediation identified after #1696.

Shift ownership now lasts through declared rendering completion and preserves native animation, pointer, and painted endpoint evidence until judgment. Draft-loss checks share exact trusted-input callback provenance instead of elapsed windows; native-await fixtures explicitly capture their committing callback. Native watcher clocks remain separate from controlled product timers.

Lock races acknowledge actual kernel contention, adapter tests observe completed scans, and reaper tests control the grace clock. Rest checks execute due timer callbacks, elapsed-age tests fix their date, and temporary server shutdown waits for active work to finish. Testing instructions explain these boundaries, and the completed remediation TODO is removed.

Validation: normal and ten-times-delayed completion controls pass while independent passive shift/draft-loss controls still fail. Held paint, resize, native animation retirement/replay, real draft submission, lock contention, adapter lifetime, reaper decisions, and active-request shutdown have targeted and independent review coverage. The fresh Python/browser landing gate passes 2,117 tests, with one skipped, including edited nightly cases. All 197 runtime checks and pre-commit pass.

This was written by Codex on behalf of max-sixty

Functional sensors previously classified slow input work by elapsed windows,
while process races could pass before a contender reached its kernel lock.
Keep input ownership through declared rendering and exact scheduled callbacks;
retain native paint evidence until it is judged. Native await fixtures capture
their committing callback rather than guessing among pending operations.

Separate native paint clocks from controlled product timers. Complete rest
callbacks explicitly, fix elapsed-age dates, and hold animation/race edges.
Native animation completion and replay retain their actual endpoints; later
resizing cannot replace a preceding passive paint. Acquire real lock-contention
and adapter-scan acknowledgements, and control the reaper's product grace clock.

Temporary page close now joins completed requests rather than expiring its
five-second join. Package reader disposal fixtures clear typed filters before
disconnecting their widget: disconnection itself does not put the user's words
away. Preserve passive-fault controls alongside 1x/10x completion cases.

Remove the completed clock-remediation TODO and document the sensor clock and
native-await fixture contracts in the testing instructions.
@max-sixty
max-sixty merged commit ed9c68a into main Oct 4, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/hosted-publication-diagnostics branch October 4, 2026 06:30
max-sixty added a commit that referenced this pull request Oct 5, 2026
…1745)

`a` now pages through everything waiting on the user, not only Asks, and
the banner counts both queues: "N on you · M on Claude". This is step 3
of the plan on the design page, `notes/what-needs-you/page.html`, which
this PR also adds. The queue and task code is marked experimental.

## The walk

- `a` / Shift+`a` (`runtime/queue-walk.js`, replacing the Ask walk in
`asks/view.js`) visit, in page order:
  - open Asks;
- threads whose attention is on the user (a prose question, or a failed
send to resend);
  - page widget moves handed back to the user.

  A thread holding an open Ask is visited once, as the Ask.
- The walk has no arrival of its own. An Ask arrives through the Ask
view, a thread through the `t` walk's `arriveAtThread` (pulled out of
`navigation.js`), and a widget move through travel. The announcement
reads "1 of 2 waiting on you · Thread".
- `t` still walks every open thread.

## What counts as "on the user"

- Python's `agent_state.queues` selects from the served Asks, thread
attention, workflows and tasks. It now lists each thread once.
- `runtime/queues.js` makes the same selection from the browser's own
reading, which already holds the tab's unsent moves. A thread message
still sending counts on the agent at once, replacing that thread's owed
answer.
- The browser keeps its own copy of the rule because it reads the Asks
of the revision on screen and folds in local sends.
`tests/served_records.py` builds a served state covering every kind, and
`tests/runtime/queues.test.mjs` holds the JS selection equal to
Python's.

## The banner

- The status row ends with "N on you · M on Claude" in a box sized for
"9 on you · 9 on <agent>", with tabular digits. A count changing moves
nothing, and the box only grows.
- The "waiting", "queued" and "saved" counts move off the row into the
details popup. That popup names tasks inside the agent sentence.
- The counts are their own banner item. On one row nothing else changes.
When the banner wraps (below about 794px), the agent's sentence keeps
the first row and the counts lead the second, shown only where the
controls leave room for them whole, so "Approve version" and the search
steps never truncate. While hidden they stay readable in the status
disclosure.

## Supporting changes

- `materializeAsk` is now a synchronous lookup plus an awaited thread
build only when the Ask's nodes are missing. Arrival happens in the
key's own turn, which #1707's stricter typing check requires.
- `tests/input_work_watch.js` attributes a Lit update to the input that
requested it. An element's first update is dated by its connection, so
an element built under a key and connected later doesn't credit that
key.
- One `atWork` in `thread/workflow.js` replaces three copies of the
stage check.
- `page check --render`'s Ask screens step past a widget move handed
back to the user instead of stopping there, and an `a` step whose thread
arrival newer input cancelled announces nothing.
- Updated to match: the references (`authoring-asks.md`,
`page-authoring.md`, `packages.md`), the registry's
`x-awaits`/`x-ask-surface` text, the glossary, and the feature gallery
and corpus.

## Tests

- New:
`test_a_walks_what_waits_on_you_and_the_banner_counts_both_queues`, the
parity tests, and the words-watch cases for Lit updates.
- Status-text tests now expect the shorter row.
- Two widget tests that read the scroll mid-glide now wait for it.

Local: `npm run test:runtime`, `npm run test:browser`, `npm run
check:browser`, the shift-watch and words-watch suites, and `wt hook
pre-merge`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants