Skip to content

Keep a run's stored stages on reattach and open card diagrams fitted - #696

Merged
lavaman131 merged 2 commits into
mainfrom
keep-run-stages-and-fit-card-diagrams
Oct 20, 2026
Merged

lavaman131 merged 2 commits into
mainfrom
keep-run-stages-and-fit-card-diagrams

Conversation

@lavaman131

@lavaman131 lavaman131 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Two fixes: a finished workflow run lost its stages when an attached Planner reattached, and a wide Mermaid diagram on a decision card opened cut off at the card's edge.

A run's stored stages survive a reattach

A Planner that reattaches reports the runs it remembers again. An ended run whose stages it no longer holds arrives as a full card with no stages. That card replaced the run's stages: Chat deleted the stages it had stored and showed a card with none. A finished run's "+N earlier" then unfolded to nothing, even after a reload.

The rule now: a full card with "stages": [] for a run that already has stages keeps them. Its other fields, such as the status and times, still change the card, and its earlierStages is ignored. A full card with any stages still replaces them all, so the contract for clients that send stages is unchanged. docs/agent-connection.md states the rule under Run stage deltas.

  • apps/server/src/harness/remote/link.ts: within one agent connection session, an empty full card keeps the session's stages for that run. Delta cards that follow add to them.
  • apps/server/src/chat/service.ts: for a report from a later session, Chat keeps the card's stages and leaves the stored ones alone.

Runs whose stages are already gone cannot be restored. Chopin keeps no other record of them:

  • Chat's run card holds only the latest 12 stages, and the reattached report overwrote that card.
  • The document checkpoint copies the card within half a second of each change.
  • Channel events and document versions do not record runs.

No repair task was added. It would have nothing to restore from.

A card's diagram opens fitted to the card

A Mermaid diagram on a decision card opened at its drawn width, so a chart wider than the card was cut off until someone pressed Fit diagram to width. A card's diagram now opens fitted to the card's width, with Actual size to draw it at its own size and scroll it. On a phone the card offers Expand diagram for a full-screen reading. A diagram in the document opens exactly as before.

Verification

  • Tests written red first:
    • The link test failed on the old code because an empty full card cleared the session's stages.
    • The Chat test failed because the stored stages went from 16 to 0.
    • The editor unit test failed because the card's diagram rendered without data-fit.
    • Both new browser tests failed because the card's drawing scrolled and was cut off.
  • bun test: 6473 passed. bun run types and bun run ci pass, and no design-contract hashes changed.
  • Chromium: decision-markdown, wide-content, run-card and planner-attachment all pass (20 tests). The new browser tests check the card at 1280 px and on a 390 px touch phone.
  • apps/connector is unchanged.

Before, 1280 px: the card diagram opens at its drawn width, cut off at the card edge

After, 1280 px: the card diagram opens fitted to the card, with Actual size

Before, 390 px touch: cut off at the card edge

After, 390 px touch: fitted, with Expand diagram

lavaman131 and others added 2 commits October 19, 2026 18:58
A Planner that reattaches reports the runs it remembers again, and an ended run
it no longer holds the stages of arrives as a full card with no stages. That
card replaced the run's stages: Chat stored nothing for it and deleted the
stages it had stored, so a finished run's "+N earlier" unfolded to nothing,
even after a reload.

A full card with no stages for a run that already has some now keeps them.
Its other fields, such as the status and times, still change the card, and its
earlierStages is ignored. The agent connection keeps the session's stages for
the run, and Chat keeps the card's stages and leaves the stored ones alone for
a report from a later session. A full card with any stages still replaces them
all. docs/agent-connection.md states the rule under Run stage deltas.

Stages already deleted cannot be restored: Chopin keeps no other record of
them. Chat's card carries only the latest 12, and the reattached report
overwrote it; the document checkpoint copies that card within half a second;
channel events and document versions do not carry runs.

Assistant-model: Claude Opus 5.5 (fast)
Assistant-workflow: inline (fast subagents)
Assistant-verification: bun test (unit, domain and memory storage)
Assistant-verification: bun run types and bun run ci
Assistant-verification: Chromium run card and Planner attachment suites
Co-authored-by: Alex Lavaee <alexlavaee@microsoft.com>
A Mermaid diagram on a decision card opened at its drawn width, so a chart
wider than the card was cut at its edge until the reader pressed "Fit diagram
to width". A card's diagram now opens fitted to the card's width, with "Actual
size" to draw it at its own size and scroll it. A phone still offers "Expand
diagram" for a full-screen reading. A diagram in the document opens as before.

Assistant-model: Claude Opus 5.5 (fast)
Assistant-workflow: inline (fast subagents)
Assistant-verification: bun test (unit, domain and memory storage)
Assistant-verification: bun run types and bun run ci
Assistant-verification: Chromium decision Markdown and wide content suites at desktop and phone sizes
Co-authored-by: Alex Lavaee <alexlavaee@microsoft.com>
@lavaman131 lavaman131 self-assigned this Oct 20, 2026
@lavaman131
lavaman131 merged commit e95618a into main Oct 20, 2026
24 checks passed
@lavaman131
lavaman131 deleted the keep-run-stages-and-fit-card-diagrams branch October 20, 2026 02:28
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