Skip to content

runtime: sync the vendored DS Bot to upstream v0.4.3 - #3474

Merged
Birfy merged 8 commits into
mainfrom
upstream/ds-bot-v0.4.3
Dec 1, 2026
Merged

Birfy merged 8 commits into
mainfrom
upstream/ds-bot-v0.4.3

Conversation

@Birfy

@Birfy Birfy commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

What

Vendor upstream Fei2411/DS-Bot v0.4.3 (tag 5a9dc8d3dc9e2dc22679a97e7028476ace62640c, tree 0d7ebe34, released 2026-11-29T22:37:49Z) byte-identically under runtime/ds-bot-upstream/, and rewrite runtime/ds-bot-upstream.pin.json for the 12 pinned paths. main was pinned to v0.3.10.

This pull request is opened by hand. The scheduled tracker cannot open it: this organisation forbids GitHub Actions from creating pull requests, so .github/workflows/ds-bot-upstream-track.yml syncs, tests, pushes the branch and then fails at gh pr create. See #3473.

Pinned ids

Computed locally from the upstream tarball and cross-checked against upstream git objects (all 12 paths agree with 5a9dc8d3:<path>):

pinned path type id vs v0.4.2
ds-bot tree 434a917889081cb83bdde0c18cd54702587fd91e changed
link tree 313b7904c0364483ed516fc34041a2f344ca2889 unchanged
app/ui/src tree 3926d002e4f23c8fb6766688fe27d2368b8ea8e6 changed
app/package.json blob ef99e26354316c6e2e9939e8e9adcc3828f795d9 changed
mobile/src/team/gated.ts blob fc59c4950e64dfa77b182d4409bc2f48ed6074ed changed
start.ps1 blob 8b9fa46128bf866b8b8f7b4812a0ab696e84a8ec unchanged
docker/Dockerfile blob dda4a5407e49082ca38f8ecb6a2aa4f1108a010b unchanged
docker/entrypoint.sh blob 56f48c13f38672552a642e600225eaf4576c7f7e unchanged
docker/docker.patch.yml blob 3417c350d13f21c71698c04136fd4084704cdbd7 unchanged
docker/test.mjs blob a2f76b753233894abe986526a6858df51f812fee unchanged
LICENSE blob 261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 unchanged
NOTICE blob 1ac054d2a0324b760cddac6d5d91ea6da954d499 changed

node scripts/ds-bot-upstream.mjs check → ok (Fei2411/DS-Bot@5a9dc8d3dc9e, ds-bot 0.4.3, v0.4.3; 12 paths), run locally on the committed tree.

UPSTREAM.md now names v0.4.3 as the pin; its "update with" example moves from v0.3.10 to v0.4.3.

The fourth commit raises the pin from 12 to 18 paths. Five files under app/src/, scripts/ and telemetry/ are imported by the vendored upstream test tree, and a sixth (scripts/scan.mjs) is spawned by test/scan-script.test.js; each is pinned as a single file (81,727 B in total) instead of vendoring those three whole trees.

Commits

  1. 7db6d678 — vendor the v0.4.3 tree and rewrite the pin (12 pinned paths), tree b3f96c46.

  2. cb106b0c — move the shipped-license and reuse-audit records onto the v0.4.3 bytes: NOTICE 18,626 B / sha256 d7e82004… / blob 1ac054d2…, tag and commit pinned to 5a9dc8d3, ON_DISK in scripts/verify-reuse-audit-pins.py, and the two OFL 1.1 texts that v0.4.3 ships in ds-bot/assets/fonts/. 8 files, +43/−14, tree d0e1cdad.

  3. a37daba1 — port the native overlay to the v0.4.3 sources instead of carrying the v0.3.10 hunks. native-ds-bot.patch is regenerated against v0.4.3 and still holds 17 diff --git sections; the overlay table pins each of the 17 deployed files by git blob sha1, upstream side and deployed side. 6 files, +771/−1027, tree 1b3518d7.

  4. 936a3f3b — pin the six files the vendored upstream tests read, and give the upstream suite an explicit selection set in scripts/upstream-test-selection.mjs plus scripts/upstream-test-exclusions.json. 13 files, +2349/−6, tree d35e74d9.

  5. c9480e80 — restore the FlyBot private-reply resume pipeline in the regenerated overlay: native-ds-bot.patch regains flybotPrivateReply, flybotPrivateReplyForTurn, resumeOrigin and delete source.rpcId in carryOriginSource, and the overlay table's deployed hash for src/host/parts.js moves from 8895dad8… to 95d9da41… because the patch now changes that file. native-ds-bot.patch 124,779 → 126,202 B, native-ds-bot-overlay.mjs 4,926 B. 2 files, +25/−3, tree e973d9af.

  6. ab505580 — treat a null result from rt.flybotWorkspaceTeam.setupTools(sessionId) as "not in setup". The ported setupOnlyTools handler read that call as Set | undefined, but runtime/flybot-workspace-web/features/agents/team-creation.js returns Set | null and test/agents.test.js asserts null, so the ordinary branch evaluated null.size inside the llm/stream handler. One line: if (!setup || setup.size === 0) return next(). native-ds-bot.patch 126,202 → 126,189 B / blob d39aa86d, native-ds-bot-overlay.mjs blob 621196d5 with src/host/tools.js deployed digest 37e847d3… → d6d75ca0…. 2 files, +2/−2, tree 29060b6c.

  7. df0fde10 — close an imported native turn with a completed reason. runtime/flybot-workspace-web/features/agents/history.js wrote two turn/end events without data.reason, and the vendored conversationContinuation projection reads reason.kind, so the first buildCell over an imported session threw Cannot read properties of undefined (reading 'kind'). Two lines add reason:{kind:'completed'}. 1 file, +2/−2, tree fc9fc53a.

  8. 77a2eb13 — lend the Bot's foreground to a private chat while a steer is handed on. The pinned host cuts a running turn only when chatOf(botId) is the session being steered (src/host/steer.js, isActiveForeground), and a FlyBot private chat never is, so container-gateway-isolation waited 45 s for the corrected reply and failed. native-chat.js gains borrowForeground / releaseBorrowedForegrounds / dropBorrowedForeground: the previous sessionId is kept beside the borrow in the workspace record, so a save inside the window writes a real foreground and a crash can be undone, and it is put back only while our own value is still there. ds-bot-bridge.mjs borrows before the mode:'steer' submit and releases on turn finish, on dispose, and after rt.load() on start, where only a chat this bridge mapped is ever cleared. 2 files, +84/−2, tree b24c2f64.

The diagnostics used to locate the two failures fixed by commits 7 and 8 live on separate dev/3474-diag* branches, not here: this branch carries the eight commits above and no probe. The second change is a real state write (the workspace record's sessionId is borrowed for the length of a steer), so its three safety parts — conditional restore, release on dispose, self-heal on start — ship together.

Why six files and one exclusion

upstream / Upstream suite runs the vendored upstream test tree, so every file those tests import has to exist in the pin. Six did not; they are now pinned as single files. The tree is otherwise unchanged, and scripts/upstream-test-selection.mjs picks the selection by walking the relative imports of the selected tests (vm.SourceTextModule, in a child process — not a line regex): on the pinned tree it reports running 384 of 385 (1 excluded), 13633 relative imports inside the pin.

The one excluded test is ds-bot/test/ci-workflows.test.js. It reads the upstream repository root (.github/workflows/*.yml, CHANGELOG.md, mobile/src/), i.e. it asserts the upstream project's own release pipeline, not the vendored tree. Excluding a test is only acceptable if the exclusion cannot go stale silently, so the selection fails closed on four conditions: the exclusion list goes stale, an exclusion stops being a test/*.test.js path or loses its reason, a selected test imports something outside the pin, or ds-bot/package.json's test script changes shape (which is how a newly added upstream test file would otherwise be skipped without notice). scripts/upstream-test-selection.test.mjs covers those conditions.

The overlay port in this bump

  • src/client/client.js is a build product of scripts/build-client.mjs (its header says so). The 18 three-way conflicts in it were not resolved by hand: on a pristine v0.4.3 tree the build check exits 0, our v0.3.10 bundle equals the rebuild of our src/client once esbuild's node_modules path comments and import_reactNN counters are normalised, and the bundle was regenerated from the merged src/client instead. The regenerated bundle reproduces the four bundle assertions in recipe.test.js, and the deployed-side hash pins the regenerated bytes.
  • The two overlay file sets moved with upstream: the Chinese locale dictionary now lives in src/client/locales/zh.js and the team actions in src/client/team-core/actions.js, so those two files are pinned and src/client/i18n.js is no longer part of the overlay.
  • scripts/upstream-test-cleanup-overlay.mjs now only checks the two fixtures instead of rewriting them: upstream changed rounds.test.js (sha256 cd1bad125d770e00…) and delivery-dedup.test.js (9f30406888611b76…) to drain before deleting, so both replacements would be no-ops. The guards stay, so an upstream regression turns the step red instead of passing silently.
  • The overlay fails closed on a hash mismatch and is idempotent on a repeated run; both were exercised with deliberate tampering of a deployed file and of a pristine source file.

Not settled here

Three overlay hunks are not byte-equivalent to the v0.3.10 ones by design, because upstream replaced the engine under them: src/host/tools.js (non-equivalent port), src/host/bot-tasks.js (one extra isFlyBotWorkspaceForeground call), and the 'open' mapping in the group protocol, which is intentionally left as it was. No parity claim is made for those three.

Out of scope

.github/workflows/ds-bot-upstream-track.yml (#3448, #3451), the DSH version the image installs, and any DS-Bot product change of our own. The fourth commit edits .github/workflows/ds-bot-upstream.yml, which is the workflow that runs this suite, not …-track.yml.

Known limits of this head

Two limits came out of review after the CI run. They are recorded here rather than fixed in this head, because another commit would void the evidence below.

  • The borrowed foreground lasts one replacement turn, not just the cut. It is set in runtime/flybot-image/ds-bot-bridge.mjs once the steer prompt is assembled and before prompt({ mode: 'steer' }), and it is released only inside finish(), which also runs on the replacement reply, on the timeout, on an event interruption, on an inbox removal and on a stop. For that whole turn chatOf(botId) therefore answers the mapped private chat, and the memory and learning read points that take tag.sessionId see the part session for that turn. This does not change the steer acceptance criteria, but it is the window this head actually creates.
  • The steerForeground marker can be left behind. Where the restore path in runtime/flybot-workspace-web/lib/native-chat.js decides the part is not ours, or that chatOf no longer matches, it continues without deleting the marker, so the flag keeps being written back to the record on every save. It never touches bot.sessionId and is never read as a session id, so it cannot re-point a foreground; clearing it is a follow-up slice, not part of this bump.

Evidence

Local, on this head:

  • 355 files added or changed, 4 removed, relative to the v0.4.2 vendor tree; everything outside runtime/ds-bot-upstream/ and its pin is untouched.

  • Rebuilt the root tree from the pinned objects: b3f96c46e71f652301ef7ef3f61ecab7caa8f915, equal to the first commit's tree; d0e1cdad and 1b3518d7 are the trees of the second and third commits.

  • Third commit, local readings on its exact payload: node scripts/ds-bot-upstream.mjs check exits 0 (ds-bot 0.4.3, v0.4.3; 12 paths); ds-bot-upstream.test.mjs 4/4; clock and cleanup suites 6/6; the overlay contract harness 1/1; the six runtime/flybot-image suites 27 pass / 1 fail, the single red being model-api.test.js:66, whose /run/secrets/flybot-workspace-model-api.json exists on this host and not in CI.

  • test/native-open-parts.test.mjs cannot run on this host (it needs @deepseek-ai/dsh-llm from npm run harness), so that suite is not covered locally.

  • Fourth commit, local readings on its exact payload: the selection script reports running 384 of 385 (1 excluded), 13633 relative imports inside the pin; its 10 tests pass; the five affected upstream tests (chatgpt, pure-base-sync, release-milestone, telemetry, scan-script) pass 57/57; node scripts/ds-bot-upstream.mjs check exits 0 with 18 paths; the workflow's run blocks pass bash -n.

  • Fifth commit, local readings on its exact payload, on a pristine v0.4.3 tree: the new patch with the new table exits 0 and recomputes all 17 deployed hashes, landing src/host/parts.js on 95d9da41… (293,035 B against 292,517 B pristine); the new patch with the old table exits 1 with Unexpected DS-Bot overlay result: src/host/parts.js at native-ds-bot-overlay.mjs:94; the old patch with the old table exits 0 and leaves 8895dad8… in place, so the baseline is untouched. runtime/flybot-image/test/recipe.test.js 11/11 on the same payload; it depends on @deepseek-ai/dsh-llm for one suite (native-open-parts.test.mjs) which this host does not have, so that suite is still not covered locally.

CI on this head (77a2eb132ac8c2a53b579b960667bed94ce1188e): 16 check runs, all success, including runtime-image / Build and smoke under the manager contract, upstream / Pin and vendor tree, both upstream / Upstream suite jobs, upstream / Container startup smoke, Management API · Python 3.11 and 3.13, Web and compose planner, the three provenance jobs, both social-host jobs, browser / screenshots, runtime-image / Image recipe contract tests, and the FlyBot required checks rollup.

The step that was red on the previous head is read the same way on both: on df0fde10 it ended gateway isolation failed: timed out waiting for corrected native reply with exit code 1 (03:44:43Z); on this head it prints {"gateway_isolation":"ok",…}. After that 45 s wait the step asserts the replacement reply is succeeded with body exactly CI-STEER-COMPLETED, that /tmp/ci-steer-provider-closed exists, and that the journal holds a turn/end whose reason.kind is aborted and whose reason.reason is {kind:'hook', reason:'ds-bot/steer'} — so this head is green because the pinned native steer hook cut the model, not because a timeout stopped happening.

The last completed head was 8ae4dd6cbab97a9e734e33ef6f8c463427960b31, which carried the temporary diagnostics. There runtime-image / Build and smoke under the manager contract (job 141956956578, 15:27:12Z) failed with B1 turn: reason {"kind":"error","error":{"message":"Cannot read properties of null (reading 'size')","code":"UNKNOWN"}} and B1 provider: no model request was logged: the turn never reached the provider, while its setup line showed the provider table carrying {"id":"flybot-workspace","models":["flybot-workspace-model"]}. So the provider and the model reference were in place and the turn died before any request; that reading is what commit 6 addresses. The diagnostics that produced it are not part of this head.

Local readings on commit 6's exact payload: applying its two-line diff to the fifth commit's blobs yields native-ds-bot.patch blob d39aa86d / 126,189 B / sha256 474813e0… and native-ds-bot-overlay.mjs blob 621196d5 / 4,926 B / sha256 fec804d2…; on a pristine v0.4.3 tree the fixed patch re-derives all 17 pinned pairs with src/host/tools.js at 140,295 B / blob e98da819, which is the digest the table now pins, so the overlay's fail-closed check does not abort.

Local readings, not CI, all bound to this head and to the tree above. node --check passes on both changed files. tests/ds_bot_bridge.test.mjs is 24/24, runtime/flybot-workspace-web/test/native-chat-threads.test.js is 19/19, the full tests/*.test.mjs set plus that file is 989/989 with exit 0, python discover is 379 tests OK, and a six-case harness for the borrow itself (the value written to the record, the exact restore, a host write inside the window not being overwritten, five self-heal cases, teardown) is 6/6. A second, independent rebuild from a codeload tarball reproduces tree b24c2f64 over 2577 entries, the same two blobs and zero probe strings anywhere in the tree; on that tree tests/*.test.mjs is 970/970, which is the same 989 with the native-chat file counted separately, because this branch does not carry the four tests main gained in #3480. The borrow's regression test lives in a scratch harness and is not in the repository yet.

No parity or acceptance claim is made here.

Related #3473

Vendor Fei2411/DS-Bot v0.4.3 (5a9dc8d3dc9e2dc22679a97e7028476ace62640c,
released 2026-11-29) byte-identically under runtime/ds-bot-upstream/ and
rewrite runtime/ds-bot-upstream.pin.json for the 12 pinned paths.

The pinned ids were computed locally and cross-checked against upstream git
objects: ds-bot tree 434a917, link tree 313b790 (unchanged since v0.4.2),
app/ui/src tree 3926d00, app/package.json ef99e26, NOTICE blob 1ac054d.
docker/ and start.ps1 are unchanged upstream.

UPSTREAM.md now names v0.4.3 as the pin.

Refs #3473
@github-actions github-actions Bot added the risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff label Nov 30, 2026
The vendored tree from the previous commit is DS Bot 0.4.3, so every
reuse-audit record that carries upstream bytes has to move with it:
NOTICE is now 18,626 B, sha256 d7e82004e8de..., blob 1ac054d..., and the
pins follow the new tag 5a9dc8d3 and version 0.4.3.

Records:
- pins.json and shipped-pins.json: tag, commit, NOTICE blob/sha256/size,
  plus the two font licence texts that v0.4.3 starts shipping inside
  ds-bot/assets/fonts (OFL 1.1, Noto Serif SC and Source Serif 4).
- scripts/verify-reuse-audit-pins.py: ON_DISK moves to the same values,
  so the offline audit compares on-disk bytes against the records.
- docs/reuse-audit/{SHIPPED,INVENTORY,DS-BOT-NOTICE-REVIEW}.md and
  docs/{LICENSING,REUSE_POLICY}.md: version references plus a v0.4.3
  addendum naming what changed upstream. The addendum is not legal
  advice and does not close the audit issue.

Local readings on this tree, not CI: scripts/verify-reuse-audit-pins.py
exits 0 with "all reuse-audit pin checks passed", and
tests.test_shipped_licenses is 5/5 OK.

The overlay port and the two upstream test fixtures are separate commits
on this branch; this one only moves the records.

Related #3473
The vendored tree moved to v0.4.3 (5a9dc8d3, ds-bot 0.4.3) but the
overlay in runtime/flybot-image was still the v0.3.10 one, so the image
recipe failed closed on the first hash mismatch. Re-port it onto the
v0.4.3 sources instead of carrying the old hunks.

- runtime/flybot-image/native-ds-bot.patch: regenerated against the
  v0.4.3 tree, still 17 files (client.js, 5 under src/client, 11 under
  src/host). groups.js is the one long rework: its 30 sites ride the new
  turn engine, so the hunks were rewritten rather than text-merged.
- runtime/flybot-image/native-ds-bot-overlay.mjs: the 17
  [upstream, deployed] pairs now name the v0.4.3 bytes. path moved for
  the two renamed files (src/client/i18n.js -> src/client/locales/zh.js,
  src/client/team-actions.js -> src/client/team-core/actions.js). Only
  src/client/at-menu.js is byte-identical upstream (a0feee8f), so its
  deployed hash is the only one that moved on the client side alone.
- runtime/flybot-image/test/native-shared-groups.test.mjs: the module
  loader hook keyed on the caller URL, which no longer matches once the
  overlay entry is evaluated in place; it now stubs by specifier.
- runtime/flybot-image/test/recipe.test.js: the copy list follows the
  renames and keeps src/client/i18n.js, which at-menu.js still imports.
  The fail-closed assertion itself is unchanged.
- scripts/upstream-test-cleanup-overlay.mjs: v0.4.3 upstream already
  awaits each disposer before removing its home, so the overlay no
  longer rewrites fixtures. It pins the two fixture hashes and the
  drain-then-remove ordering and fails closed on drift.
- scripts/upstream-test-cleanup-overlay.test.mjs: covers the identity
  check, runs both real hooks to observe stop-then-rm ordering, and
  asserts three separate drift cases still throw.

One port is not equivalent, on purpose: v0.3.10 wrapped per-agent
(llm/stream) hooks in filterBotAssembly, which no longer exists, so the
same filtering is a session-level hook keyed on the cache-affinity
rewrite and an empty setup set. bot-tasks.js also gains
isFlyBotWorkspaceForeground in foregroundMoveBlockReason, which the
v0.3.10 overlay did not need. The (open) mapping in logicalAddressOf and
resolveLogicalSession is left alone, so open parts still fall back to
foregroundAddress.

Local, not CI: the pin job's three commands pass (upstream check, 4/4
upstream tests, 6/6 clock and cleanup tests), the image suite is 27/28
with the only red being the /run/secrets path that exists on this host
and not in CI, and the group contract harness is 1/1.

Related #3473.
The vendored tree moved to v0.4.3 but the pin still took 12 paths, so the
pinned upstream suite cannot even load: six v0.4.3 tests statically
import files outside that set (app/src/chatgpt-relay.mjs,
app/src/locale-match.mjs — reached through app/ui/src/locale.js:6 —,
scripts/check-pure-base-sync.mjs, scripts/check-release-milestone.mjs,
telemetry/src/validate.js) and one test spawns another
(scripts/scan.mjs, resolved by scan-script.test.js from the repo root).
Take exactly those six at file level instead of widening the pin to whole
directories, so the pin keeps saying which bytes we ship.

- runtime/ds-bot-upstream.pin.json: six file-level paths, 12 -> 18. Each
  entry is {type, id, mode} with the upstream blob id and its upstream
  mode, same shape as the existing single-file entries.
- runtime/ds-bot-upstream/{app/src,scripts,telemetry/src}/*: the six
  files, byte-identical to the upstream blobs (81,727 B total).
- scripts/ds-bot-upstream.mjs: PATHS grows to 18 and says the three new
  directories are taken one file at a time. No schema change: stagedIds()
  reads the index with ls-files -s and yields ids for files as well as
  directories, so pin entries and PATHS are still checked in both
  directions.
- runtime/ds-bot-upstream/UPSTREAM.md: the table gains the six files with
  what needs each of them, "Not taken" narrows from upstream scripts/ to
  the rest of scripts/, app/src/ and telemetry/, and the schedule
  paragraph no longer claims the workflow opens a pull request: it pushes
  upstream/ds-bot-vX.Y.Z and leaves the branch name, the pin before/after
  and the suite result in the run summary for a maintainer.
- .github/workflows/ds-bot-upstream.yml: the suite step runs the selection
  script instead of npm test, and the pin job runs its test file.
- scripts/upstream-test-selection.mjs: picks the files to run and fails
  closed on four things — an exclusion that no longer names a test with a
  reason, an exclusion that is stale (the file it names does not exist),
  a selected test whose relative import lands outside the pin, and a
  ds-bot/package.json test script that changed shape (a new upstream test
  file would then silently not run).
- scripts/upstream-test-exclusions.json: one exclusion,
  test/ci-workflows.test.js, because it reads the upstream repository root
  (.github/workflows/*.yml, CHANGELOG.md, mobile/src/) and so verifies
  the upstream release pipeline, not this one.
- scripts/upstream-test-selection.test.mjs: 10 cases over a fixture and
  the real tree, one per fail-closed path above.

Local, not CI: ds-bot-upstream check exits 0 on this tree (18 paths); the
selection script reports 384 of 385 selected with 13,633 relative imports
resolved inside the pin; its 10 tests pass; and the five affected upstream
tests (chatgpt, pure-base-sync, release-milestone, telemetry, scan-script)
pass 57/57.

Related #3473.
@Birfy
Birfy force-pushed the upstream/ds-bot-v0.4.3 branch from 455a6b1 to 25b0161 Compare November 30, 2026 13:31
The v0.4.3 repack of native-ds-bot.patch dropped every line that carries
`flybotPrivateReply` into the host, so on this branch the bridge and the host
no longer agree on the handoff markers:

- `carryOriginSource` no longer sets `source.flybotPrivateReply` and
  `source.resume`, so `sourceMatches` (ds-bot-bridge.mjs:334) and `resuming()`
  (:326) can never be true;
- `startSwitch` no longer computes `flybotPrivateReply` for the switched job,
  so a resumed turn carries no marker at all.

With both predicates dead, the `user/message` handoff is not bound, the turn
ends with zero parts and the manager stores `agents/empty-reply` for a turn
that never reached the provider. The container-gateway-isolation B1 case shows
exactly that: the user row is `sent`, the assistant row is `failed` with empty
text, and the fake provider receives no request.

Both hunks restore the wording carried by the v0.3.10 patch, which the upstream
v0.4.3 sources still support: `carryOriginSource`, `startSwitch`, `isSwitchingPart`
and `rt.live` all exist there. `resume` is false in the ordinary path, so both
hunks stay inert outside a handoff switch.

The two hunks change the post-image of `src/host/parts.js`, so its deployed
digest in native-ds-bot-overlay.mjs moves from 8895dad8 to 95d9da41. That table
is fail-closed: without the update the image build aborts with
`Unexpected DS-Bot overlay result: src/host/parts.js`, which is what the recipe
contract test reported on 25b0161. A clean v0.4.3 tree now re-derives all 17
pinned pairs and only parts.js moves.

Related #3473
@Birfy
Birfy force-pushed the upstream/ds-bot-v0.4.3 branch from 25b0161 to c9480e8 Compare November 30, 2026 13:36
Birfy added a commit that referenced this pull request Nov 30, 2026
…r setup

Temporary diagnostic for the empty-reply investigation; it must be removed
before this PR merges.

Related #3474
`setupOnlyTools` in native-ds-bot.patch reads the return value of
`rt.flybotWorkspaceTeam.setupTools(sessionId)` as `Set | undefined`, but the
contract in `runtime/flybot-workspace-web/features/agents/team-creation.js` is
`current(sessionId)?.setupPending ? SETUP_TOOLS : null`, and `test/agents.test.js`
asserts that `null` explicitly. The ordinary "this session is not in setup"
branch therefore evaluates `null.size`:

    Cannot read properties of null (reading 'size')

The throw happens inside the `llm/stream` handler, before the request reaches a
provider, so the turn ends at step 0 with zero provider calls and zero parts:
the manager stores `agents/empty-reply`, and the container-gateway-isolation B1
case sees a `sent` user row beside a `failed` assistant row.

`main` never runs this branch: the v0.3.10 overlay has no `llm/stream` handler
at all, and its tools.js guard reads `setup && [...]`. In the v0.4.3 port the
neighbouring handler already guards with `if (setup && ...)`; this is the one
place that did not.

The fix is the guard alone: `if (!setup || setup.size === 0) return next()`.

`src/host/tools.js` post-image moves, so its deployed digest in
native-ds-bot-overlay.mjs goes from `37e847d3` to `d6d75ca0` (140,295 B, blob
`e98da819`). On a clean v0.4.3 tree all 17 pinned pairs re-derive with only
tools.js moving.

Related #3473
@Birfy
Birfy force-pushed the upstream/ds-bot-v0.4.3 branch from 8ae4dd6 to ab50558 Compare November 30, 2026 15:38
Birfy added 2 commits December 1, 2026 11:40
The native history import writes its own turn/end boundaries carrying only
{turn, source}. The session projection reads event.data.reason.kind while it
materializes the conversationContinuation cell, so the first stateOf() over an
imported log threw "Cannot read properties of undefined (reading 'kind')";
kick()'s empty catch swallowed it, the turn never produced a reply and the
bridge gave up at its 150 s abort.

Both import writers now close their turn with reason {kind:'completed'}: the
empty initialization head and the imported assistant boundary. Replayed the
real cell apply() over the imported event sequence: without the reason it
throws the same TypeError, with it the cell folds to
{admitted:true, failedAttempt:false, ending:null}.

Related #3474
…eer is handed on

The pinned host cuts a running turn only when chatOf(botId) is the session
being steered (src/host/steer.js, isActiveForeground), and a FlyBot private
chat never is, so a user steer waited for a reply that could not arrive and
container-gateway-isolation timed out at 'corrected native reply'.

Lend the part to the bot for the length of the mode=steer submit, keep the
previous value beside it in the workspace record so a save inside the window
writes a real foreground and a crash can be undone, and put it back only
while our own value is still there. Undo on finish, on dispose, and on start
after rt.load(), where only a chat this bridge mapped is ever cleared.

Refs #3474
@Birfy

Birfy commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

Lead review — approved

Bound to head `77a2eb132ac8c2a53b579b960667bed94ce1188e` (tree `b24c2f6466d411d4d364a90e94c918fe67427182`), 8 commits, `main` as base. Any later commit voids this record.

What this head is. The DS-Bot 0.4.3 synchronisation: 788 files, +349,017/−65,106, almost all of it the vendored upstream and the re-derived native overlay patch. The only two commits that are ours rather than upstream are the two at the tip — the `turn/end` `reason` fix and the steer foreground borrow — and together they are 2 files, +84/−2 on top of the previous tip.

Checklist.

  • Bytes: an independent codeload rebuild of the exported tree reproduces `b24c2f64` over 2577 entries, both changed blobs (`64e95a4f` / 36,649 B and `8e4ea7a4` / 5,675 B), and zero occurrences of any diagnostic marker anywhere in the tree. A tree-level diff against the previous tip shows only those two files.
  • Records: the eight records blobs, the `NOTICE` and both OFL texts are byte-identical to the base; the reuse-audit pin checks pass and the shipped-licenses test exits 0.
  • CI on this exact head: 34 check runs across the two workflow runs on this sha, all success, none cancelled and none skipped-red — including `runtime-image / Build and smoke under the manager contract`, `Image recipe contract tests`, `Pin and vendor tree`, both upstream suites on Node 22 and Node 24, both social-host checks and `FlyBot required checks`. I read the Build and smoke log myself: `gateway_isolation` reports ok once, with zero `timed out waiting` and zero `##[error]` lines, where the previous tip failed the same assertion with a timeout and exit 1.
  • Local, not CI: both changed files pass `node --check`; the bridge suite is 24/24, the native-chat suite 19/19, the full `tests/*.test.mjs` set 989/989, python `discover` 379 tests OK, and a six-case harness for the borrow is 6/6.

Known limits, recorded in the body and not fixed here. The borrowed foreground lasts a whole replacement turn rather than just the cut, and the `steerForeground` marker is not deleted on the mismatch path, so it keeps being rewritten to the record; it never touches `bot.sessionId`. Clearing it, and moving the borrow's regression case into the repository, are follow-up slices.

`risk:T3` was set by `risk-gate.yml`, not by hand, and this merge is approved by the repository owner in the working group.

Related #3473

@Birfy
Birfy marked this pull request as ready for review December 1, 2026 07:21
@Birfy
Birfy added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit b333cd0 Dec 1, 2026
34 checks passed
@Birfy
Birfy deleted the upstream/ds-bot-v0.4.3 branch December 1, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant