Skip to content

fix(chat): stop waits and first messages from misleading the assistant - #76

Merged
albanm merged 5 commits into
mainfrom
fix-chat-fabrication
Oct 7, 2026
Merged

albanm merged 5 commits into
mainfrom
fix-chat-fabrication

Conversation

@albanm

@albanm albanm commented Oct 7, 2026

Copy link
Copy Markdown
Member

Fix chat-side defects found by judged portal simulations. Each one fed the assistant (or the person) a false picture of what had happened:

  • Leftover gesture events no longer end the next wait. One click can report breadcrumbs, then location. The first ended a wait, and the second, still in the buffer, ended the next wait at once. Within SAME_GESTURE_MS (1 s) of the event that settled the previous wait, a buffered event is still reported but no longer settles a wait.
  • A wait result lists its events in the order they happened, so an older « unpublished changes » state no longer reads as coming after « draft-validated ».
  • A wait shows once, and never stays pending after its turn. The activity line now says « Waiting for you… », and only the chip names what is awaited. When a turn ends, any wait it left pending (one the person interrupted by writing) is marked done.
  • The anonymous action token is used only once it is valid. simple-directory issues it with a deliberate notBefore delay. The first anonymous message could go out before that, fail with « not yet valid », and the retry fetched an equally new token. getAnonymousToken now waits until nbf plus a 1 s margin.
  • Test only: the moderation e2e gives the stats tiles 15 s to appear (they flaked under full-suite load).

Why: the simulations showed the assistant giving instructions the person had not asked for, describing stale state as current, and losing the first message. All of this read as fabrication, but it came from the client giving the assistant the wrong inputs.

Heads-up:

  • A real second action less than 1 s after the one that settled a wait no longer settles the next wait from the buffer. It is still reported, but that wait blocks until the next action or the timeout.
  • getAnonymousToken can now block for up to ~9 s when no prefetch happened beforehand. Callers prefetch on init, so this is usually zero.
  • The host-events e2e assertions were changed to the new activity label.

albanm and others added 5 commits October 3, 2026 21:58
… end the next one

One click on a portal reported breadcrumbs, then location. The first ended
a wait, and the second, left in the buffer, ended the next wait at once:
a judged run's person got three instructions in a row without acting. An
event within a second of the one that settled the previous wait is still
reported, but no longer settles a wait from the buffer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Judged runs saw « En attente : … » twice while waiting: once on the wait's
chip and once on the activity line. The activity line now says « En
attente de votre action… », and the chip names what is awaited.

A wait the person interrupted by writing never gets a result, so its chip
kept reading « En attente » under later replies. The waits a turn leaves
pending are now settled when it ends.

The host-events e2e assertions on the activity line follow the new label
(not run here: they need the agents dev stack).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
simple-directory issues the anonymous action token with a notBefore delay
(8s), on purpose. A judged portal run's first chat message was sent
before it and failed with « anonymous action token not yet valid »; the
retry on 401 fetched a new token, not yet valid either, and the message
was lost. The token is now returned once its notBefore time has passed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A judged portal simulation: the result of wait_for_user_action listed
« draft-validated » first, then the older « unpublished changes: the person
must press « Valider le brouillon » » state, which reads as the state that
followed the validation. The event that resolved the wait and its followers
are now listed in time order.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… of the page

The stats tiles render once their request answers: under the load of the
full suite, the default 5 s ran out before « Blocked messages (30d) » showed,
while the other waits of the test allow 10 to 15 s. It passes on its own.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@albanm
albanm merged commit a0dbf79 into main Oct 7, 2026
4 checks passed
@albanm
albanm deleted the fix-chat-fabrication branch October 7, 2026 15:18
@github-actions github-actions Bot added the fix label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant