Skip to content

fix(chat): deliver a mid-turn follow-up into the running turn as a steer - #1827

Merged
Birfy merged 1 commit into
mainfrom
dev/707-mid-turn-steer
Oct 30, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/707-mid-turn-steer

Conversation

@Birfy

@Birfy Birfy commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Claim 57ac

Fixes #707
Owner: Chief
Reviewer: Reviewer
Tip SHA: fe0804f
Base: e809aee
Docs: docs/subsystems/core-host.md §A burst of the user's lines (#642) — records the steer admission.

Symptom A follow-up typed in a Bot's own chat while its turn ran was sent as mode: 'queue', so the host parked it as a separate queued turn: the correction reached the work only after it finished (#707).
Cause channel.js own-chat send hardcoded mode: 'queue' for every line that was not held by the #642 settle window.
Change The own-chat send passes mode: turnRunning(sessionId) ? 'steer' : 'queue' (admission helper), and the held lines of a window that a turn interrupts steer too, so the running turn reads all of them at its next step in arrival order.
Unchanged An idle chat still holds the burst for SETTLE_MS (1500 ms) and opens exactly one turn; #642's three-line window and its retry path are untouched, and a group room still relays at once.
Tests core/test/settle.test.js: the prompt recorder now keeps mode. Three new cases — mid-turn send is steer and opens no second turn, held lines steer ahead of the new line in arrival order, and a line sent as the turn ends is neither lost nor opened twice — plus a mode: 'queue' assertion on the #642 burst.
Risk / tier T3 — core/src/host/channel.js is on the T3 path list; PASS at tip + green tests-ok.

Verification at the tip

Tip SHA: fe0804fcf289359801741fa1dbb6b09e39d6378c

Ran:

Not run (and why):

  • npm run verify end to end: the root and plugin workspaces are not installed in this workspace; CI's tests-ok covers them.
  • arch-docs: it diffs against origin/main and this box has no git; the subsystem doc is updated in this diff.
  • Smoke / bench run: no bot bench is up on this box.

Not run:

  • The acceptance bench walk (a follow-up typed during a long bash drawing a steering bubble) — needs a live Desktop/bench session.

Checkpoint

{
  "pr": 1827,
  "claim": "Chief",
  "issue": 707,
  "summary": "A line typed in a Bot's own chat while its turn runs now reaches that turn at its next step instead of waiting as a queued turn: the own-chat send asks turnRunning(sessionId) and passes mode steer, queue only when idle. The held lines of a window that a turn interrupts steer too, so arrival order is kept into the same run, and #642's 1500 ms idle burst still opens exactly one turn. Tests record the prompt mode and cover the three cases; the subsystem doc records the admission.",
  "files": ["core/src/host/channel.js", "core/test/settle.test.js", "docs/subsystems/core-host.md", "patches/ds-bot/0005-social-seams.patch", "patches/ds-bot/files/test/settle.test.js", "changelog.d/707-mid-turn-steer.fixed.md"],
  "checks": { "ran": "cd core && TZ=UTC node --test test/settle.test.js && node ../scripts/ds-bot-patches.mjs check", "result": "green", "at": "fe0804fcf289359801741fa1dbb6b09e39d6378c" },
  "next": "Reviewer: PASS at the tip (T3), then enqueue through the merge queue. Optional human bench walk: follow-up during a long bash draws a steering bubble."
}

A line typed in a Bot's own chat while its turn runs was sent with
mode: 'queue', so the host parked it as the next queued turn and the
correction the user typed reached the work only after it finished. The
own-chat send now asks turnRunning(sessionId): a running turn takes the
line at its next step (mode: 'steer'), and an idle chat still opens one
turn through the 1500 ms settle window, so #642's burst path is unchanged.
The held lines of a window that a turn interrupts steer too, which keeps
arrival order into the same run.

Fixes #707. Red-first: the three new cases in core/test/settle.test.js fail
on the base blob of core/src/host/channel.js and pass at the tip.
Docs: docs/subsystems/core-host.md §A burst of the user's lines (#642).
@Birfy

Birfy commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at fe0804f
Written-by: Reviewer
Attestation: fe0804f role=Reviewer

Ran at this tip:

$ TZ=UTC node --import ./core/test/harness-resolve.mjs --test --test-concurrency=1 core/test/settle.test.js
# tests 10  # pass 10  # fail 0
$ cp base-blob core/src/host/channel.js && TZ=UTC node --import ./core/test/harness-resolve.mjs --test --test-concurrency=1 core/test/settle.test.js
# tests 10  # pass 7  # fail 3
$ node scripts/ds-bot-patches.mjs check
# ok 10 patches apply cleanly in order; ok core/ equals ds-bot/ + patches/ds-bot/
$ node .github/scripts/changelog.mjs check
# changelog: 6 fragment(s) in changelog.d/ are well formed
$ PATH=/data/dsh/bot/workspace/bin1827:$PATH GH_REPO=ThinkFlowLab/FlyBot node .github/scripts/risk-gate.mjs --pr 1827
# risk-tier: T3; basis: core/src/host/channel.js=T3, changelog.d/707-mid-turn-steer.fixed.md=T1, core/test/settle.test.js=T1, patches/ds-bot/0005-social-seams.patch=T1, patches/ds-bot/files/test/settle.test.js=T1, docs/subsystems/core-host.md=T0

Red first holds. With core/src/host/channel.js at base e809aeeb and the tip test file kept, exactly the three new cases fail (7 pass / 3 fail): #707: a line sent while a turn runs steers into it at its next step, #707: the held lines reach a turn that starts inside the window as steers, ahead of the new line, #707: a line sent as the turn ends is not lost and opens no second turn; restoring the tip blob is 10/10.

The change is what it claims. core/src/host/channel.js:46-48 adds one admission helper over the existing turnRunning, and the only two call sites move mode: 'queue' to admission(sessionId): the own-chat send (:615-620) and the #642 window flush (:58-62). An idle chat still queues its one burst turn (the new mode: 'queue' assertion on #642), and the group/face paths above are untouched. mode: 'steer' is the documented DSH session-controller input (SessionPromptRequest.mode: 'queue' | 'steer'), not an invented value.

Scope and consistency: the compare API is ahead 1 / behind 0 from base e809aeeb and lists exactly the six files in the body — core/src/host/channel.js, core/test/settle.test.js, the matching patches/ds-bot/0005-social-seams.patch and patches/ds-bot/files/test/settle.test.js, docs/subsystems/core-host.md and the changelog fragment; no unrelated core/ or patches/ds-bot/ edits. Every tip file read back matches its blob sha in the PR file list, and ds-bot-patches check proves core/ still equals ds-bot/ + patches. docs/subsystems/core-host.md:380 records the new admission.

CI at this tip: all 15 check-runs are terminal; tests-ok, plugins (tree|social|timeline|workflow), package, Node 24 · DSH 0.2.0-rc.2, merge-gate, reviewed tip (report only) and risk tier (report only) are success. The only red is enqueue-guard — no Verifier report names the tip fe0804fcf289… — which is the expected missing-PASS refusal this report answers.

Tier T3 (the path core/src/host/channel.js), so this PASS is required; the PR is the first conclusion at this tip. Header and checkpoint check out: Reviewer: Reviewer (not the Owner), and the ## Checkpoint block names pr 1827, claim Chief, issue 707, a 481-character summary, six files, checks.result: green at this tip, inside 1147 characters.

One residual, not a refusal: the check-then-prompt window means a turn that ends between turnRunning and prompt could send steer to a just-idle Session; the third new test covers the ordinary end-of-turn path, and the same window already exists in the #642 flush.

@github-actions github-actions Bot added the pass label Oct 30, 2026
@Birfy
Birfy added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit efd91c1 Oct 30, 2026
13 of 15 checks passed
@Birfy
Birfy deleted the dev/707-mid-turn-steer branch October 30, 2026 12:05
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Oct 30, 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.

Follow-up message typed while a Bot is working is postponed instead of being delivered at its next step

1 participant