Skip to content

zgx Control room: Capture has its composer before there's a Brain dump - #1506

Open
grishnakov wants to merge 1 commit into
zeronsh:zeron/orchestratorsfrom
grishnakov:zgx/capture-before-brain-dump
Open

grishnakov wants to merge 1 commit into
zeronsh:zeron/orchestratorsfrom
grishnakov:zgx/capture-before-brain-dump

Conversation

@grishnakov

@grishnakov grishnakov commented Nov 18, 2026 •

Copy link
Copy Markdown

Targets #1474 (zeron/orchestrators).

Problem

On a profile that has never sent a dump, the Control room's Capture widget is empty: no composer at all. That means the first dump can't be sent.

The engine creates a device's Brain dump only when the first dump arrives (ensure_brain_dump in crates/engine/src/orchestration/brain.rs). Since c493ea3 ("Capture is the chat composer"), Capture's composer is bound to the Brain dump's chat. In screens/control/page.luau, brain_dump() returns nil when no brain_dump orchestrator exists, so LaneTab.Composer renders an empty ui.div {}. The control fixtures always seed orc-brain, so the tests never covered this.

I hit it on a fresh data dir with this PR's build. Its only orchestrator was a standard one, so Capture was blank.

Fix

In apps/zgx/ui/screens/control/page.luau:

  • Until a Brain dump exists, Capture's composer (inline and floating), its drop zones and the floating chip count are bound to a stand-in chat id, M.NO_BRAIN_DUMP. Side chats already bind a composer to an id the engine doesn't have yet (lanes.new_id), so this is a path the lane code supports.
  • M.take is unchanged. It still sends orchestration.dump(..., brain_dump(), ...), so the first dump goes out with no chat, and the engine already handles that by creating the Brain dump.
  • When the Brain dump's row arrives, the composer switches to it. If the keys were in the stand-in composer when the first dump was sent, they move to the new composer.

No engine or Rust changes.

Known limitation: a model picked before the first dump has no chat to be set on. The bridge only builds config when it has a chat. So that one dump runs on the engine's default fast model, the same as a dump sent with no pick. Every later dump uses the picked model as before.

Tests

  • control_world.luau: a new fixture.no_brain_dump command removes the Brain dump. Its dump stub brings it back on the first dump, as the engine does, and notes dump-chat:none when a dump is sent without a chat.
  • control_receipt.test.luau: new test "capture has its composer before there's a Brain dump, and the first dump makes it". It checks that the composer is there, the first send is a dump with no chat, the composer then switches to orc-brain with the keys kept, and the second dump is the Brain dump's. On the unfixed page.luau it fails because there is no composer textbox.

Run locally on Linux with the pinned zgx CLI (e49ae7a3):

  • zgx test ui capture: 13 passed.
  • scripts/ci/test-zgx.sh ui: 16 tests failed that aren't on the known-failures list. I reran all 16 on this branch and on cc8ff03:
    • 14 fail on both (plugin_settings, progress_embed, lanes_in_place, shell_in_place, and the control_qa Progress test).
    • 2 pass on both when run alone and fail only under full-suite load: control tabs: a hidden tab does no work… and perf: one thread's status change, Progress alone. They passed 3 out of 3 alone on this branch.
  • zgx lint on the changed files: 0 errors, the same 8 token warnings as base.
  • zgx check ui (luau-lsp 1.70.1): 941 errors and 82 warnings, identical to cc8ff03. The diagnostics in the changed files are the same ones, shifted by the added lines.

I didn't do a manual run-through in the app.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The engine makes a device's Brain dump with its first dump
(orchestration/brain.rs `ensure_brain_dump`), but Capture's composer was
bound to the Brain dump's chat and drew nothing without one: on a device
that had never dumped, Capture was empty and the first dump couldn't be
sent.

- Until there's a Brain dump, Capture's composer (inline and floating)
  and its drop zones are bound to a stand-in chat. Its send goes as a
  dump with no chat, as before; the engine makes the Brain dump with it,
  and the composer is the Brain dump's once its row comes, the keys
  going on to it if they were in the stand-in's.
- A model picked before the first dump has no chat to be set on: that
  dump runs on the engine's fast model, as one sent with no pick does.
- control_world: `fixture.no_brain_dump`, and its dump stub brings the
  Brain dump back as the engine would; a test in control_receipt.

This branch has not been deployed

No deployments
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