Repository navigation
Description
Follow-up to the review of PR #3474 (head 77a2eb132ac8c2a53b579b960667bed94ce1188e, merged as b333cd019287129e85dd5690ae3003168070a2c9). Both items were found during review and recorded in that PR's body instead of being fixed there, because another commit would have voided the CI evidence on that head.
1. The steerForeground marker is not cleared on the mismatch path
runtime/flybot-workspace-web/lib/native-chat.js writes a marker into bot.flybotWorkspace.steerForeground when the bridge lends the bot's foreground to a private chat for a steer handoff. The restore path deletes it only on the path that actually restores. Where ownsPrivateChatPart says the part is not ours, or where chatOf(bot.id) no longer matches, the code continues without deleting the marker.
Effect: the flag stays on the bot record and is written back to disk on every subsequent state save (the record is part of state.bots). It never touches bot.sessionId and is never read as a session id, so it cannot re-point a foreground — this is hygiene, not a correctness bug that changes behaviour today. It becomes a real problem the moment anything starts reading the flag as "a borrow is currently active".
Expected: every exit path of the restore leaves no marker behind, including the mismatch and not-ours cases.
2. The borrow's regression case is not in the repository
The six-case local harness that covers the borrow (the value written to the record, the exact restore, a host write inside the window not being overwritten, five self-heal cases, teardown) lives in a scratch file outside the tree. Nothing in tests/ or runtime/flybot-workspace-web/test/ covers the borrow, so a future change to native-chat.js or the bridge can break it with CI green.
Expected: the case lives next to the other native-chat cases, runs in the normal suite, and fails if the marker is left behind.
Scope
runtime/flybot-workspace-web/lib/native-chat.js(marker clearing)runtime/flybot-workspace-web/test/native-chat-threads.test.js(or a new test file next to it) for the regression case
One reviewable slice, both items, because the test is what pins the fix. Do not fold in the borrow window's breadth (the foreground is held for a whole replacement turn) — that is a design note recorded in #3474, not a defect.
Acceptance
- A case that drives the mismatch path and the not-ours path asserts no
steerForegroundkey remains on the record afterwards. - The borrow's happy path is covered in-tree: the value is on the record while the handoff is in flight, the previous value is restored exactly afterwards, and a host write inside the window is not overwritten.
- Local suite green, with the command and the counts in the PR body; CI green is read separately from the check runs.
Related #3474
Activity
Birfy commentedon Dec 1, 2026
Claimed. Branch:
dev/3482-steer-foreground-reset, cut frommainatb333cd019287129e85dd5690ae3003168070a2c9(tree37b11b9981c6d283762d9c8e9d6330eae147bcb6).Assignee: Runtime Dev. The two items are one slice because the in-tree regression case is what pins the marker fix.