Skip to content

Ask panel follow-ups: lane order, one Stop notice, peer slugs, a flaky test - #189

Merged
ymote merged 1 commit into
mainfrom
fix/ask-panel-followups
Sep 30, 2026
Merged

ymote merged 1 commit into
mainfrom
fix/ask-panel-followups

Conversation

@ymote

@ymote ymote commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Follow-ups from the live run of the "Ask " panel (#184): issues 1, 2, 3 and 5 of that run's list. Issue 4 (script-app agents asking questions) comes in a separate PR after App Hub.

1. Order across lanes; a stopped turn's request stays

  • Cause. Each lane counts its own cursor.seq (the peer's session is long, the person's context new), so the panel's seq sort mixed the lanes. Also, the kernel sends a turn's user_message only when the turn ENDS (ledger of the live run: the person's question at seq 226 after its answer; the stopped turn has turn_started and no user message at all). So the request line landed after its answer, and a stopped turn's request never showed.
  • Fix. app_chat::model: within a lane, ledger order. Across lanes, one clock: the order events reached the panel (stream events carry no time; assistant_persisted alone has persisted_at). History already comes merged by persisted_at (feat(app-peers): the person's lane runs in parallel with the system agent's, sharing history; pin octos e045c727 [skip ci] #173). A turn's request line stands where the turn started. The broker records the words it sent (the person's message, the system agent's peer/input) and hands them over with turn/started (request: {text, speaker}). The conversation's history adds a stopped turn's unrecorded request at its start time.

2. One "turn interrupted by client" on Stop

The send's error is shown only when the turn never started. Once it started, its turn_terminal already says how it ended.

3. The peer slug for the system agent

The system-chat note and agents.list (and agents.ask) now carry the peer slug (os-news-22a12f90, via new OctosAppService::peer_slug, default None). They say to use it with peer_send_input, or to find it with peer_list, and never the app id.

5. The flaky real-kernel test

the_person_and_the_system_agent_talk_in_parallel_lanes_that_share_history failed under load with system turn: ... (turn_in_progress). The test drives the system session itself (turn/start via host_request). It started its second system turn while the first was still finishing: after peer_send_input returns, the system agent still writes its own answer. It is not a broker race. The test now waits for its session, as the system chat does. I reproduced it deterministically by slowing that answer in the scripted model: the old test fails, the new one retries and passes. With the fix: 20/20 runs at --test-threads=4.

Tests

  • app_chat::tests::two_lanes_interleave_by_arrival_and_a_stopped_request_stays: the live run replayed (big peer seqs, small person seqs, user messages at the end, an out-of-order envelope, a stopped turn).
  • The panel test: Stop shows one notice, the stopped request stays. The slug is in agents.list and the note.
  • broker.rs: turn/started carries the turn's words; a_stopped_turns_request_stays_in_the_conversations_history.

Local checks

  • shell lib (desktop, and mobile-apps with a real kernel): all pass
  • scenario tests (real kernel, --test-threads=1): pass
  • app-peers (octos-core,ws, real kernel): pass, plus clippy
  • ai-host (default and octos-core,llm): pass, plus clippy
  • cargo check --locked for desktop and phone (default and mobile-apps): pass
  • native_apps.py --check and setup.py --check --cargo: pass

🤖 Generated with Claude Code

…y test

Four follow-ups from the live run of "Ask <app>" (#184).

1. Order across lanes. Each lane counts its own cursor.seq (the peer's
   session is long, the person's context new), so sorting both by seq
   drew the system agent's request below the person's later question.
   The kernel also sends a turn's user message only when the turn ENDS,
   and never for a stopped turn, so the request line sat after its answer
   and a stopped request never showed. Now: within a lane, ledger order;
   across lanes, one clock (the order events reached the panel: stream
   events carry no time; history comes merged by persisted_at). A turn's
   request line stands where the turn started: the broker records the
   words it sent (the person's message, the system agent's peer/input)
   and hands them over with turn/started (`request`), and the
   conversation's history adds a stopped turn's request the kernel never
   recorded, at the time it started.
2. Stop said "turn interrupted by client" twice: once from the turn's
   end, once from the send's error. The send's error is shown only when
   the turn never started.
3. The system agent tried the app id (os.news) with peer_send_input. The
   note and agents.list now give the peer slug (os-news-22a12f90;
   OctosAppService::peer_slug) and say to use it, or to find it with
   peer_list, never the app id.
4. the_person_and_the_system_agent_talk_in_parallel_lanes_that_share_history
   failed under load with turn_in_progress: the test drives the system
   session itself and started its second turn while the first was still
   finishing (after peer_send_input the system agent still writes its own
   answer). Not a broker race: the test now waits for its session, as the
   system chat does. Reproduced by slowing that answer in the scripted
   model; 20 runs at --test-threads=4 pass.

Tests: two lanes replayed with interleaved arrival (out-of-order
envelopes, user messages at the end, a stopped turn); the panel's Stop
shows one notice; the broker hands a turn's words over at its start and
keeps a stopped turn's request in history; the note and agents.list carry
the slug.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ymote
ymote merged commit 06e803a into main Sep 30, 2026
5 checks passed
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