Repository navigation
FE-1943: Show where each Brunch exchange's time goes in persona runs #10066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lunelson
merged 13 commits into
ln/fe-1960-brunch-plugin-chat
from
ln/fe-1943-shorten-turn-times
Oct 23, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
181303c
Write a turn-time packet for each Brunch persona run and turn probe
lunelson 8458125
Count skill reloads and context compactions in run packets
lunelson 33e4c56
Keep Playwright from exiting the persona launcher on SIGINT before clβ¦
lunelson a655d10
Show every destructive-edit approval under the React Compiler and runβ¦
lunelson a2ebbd5
Enable react/memo-dependencies for Brunch's plugin and keep its tool β¦
lunelson 89ebc7c
Add a persona message limit to the Brunch persona launcher
lunelson 212b328
Write the persona run packet only after the services have exited, andβ¦
lunelson 331b4b5
Rejoin stored stream chunks in chunk order
lunelson a7dd2fe
Abort automatic tools through a plain helper instead of a memoized caβ¦
lunelson 1e82f6c
Write the turn probe's packet on failure and interruption, and survivβ¦
lunelson 3182f26
Make run packets account for interrupted and damaged runs instead of β¦
lunelson 1f9866d
Start a run packet step where the cut-off step before it ends
lunelson 45b1955
Measure run packet output times from each step's request
lunelson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /** | ||
| * Writes `evidence/packet.json` and `evidence/packet.md` for each given | ||
| * persona run or turn-probe directory. Reads retained files only; spends no | ||
| * model turns. | ||
| * | ||
| * yarn workspace @apps/brunch-agent packet:run <run-dir> [<run-dir> β¦] | ||
| */ | ||
| import { resolve } from "node:path"; | ||
|
|
||
| import { writeRunPacket } from "./run-packet.ts"; | ||
|
|
||
| const directories = process.argv | ||
| .slice(2) | ||
| .map((directory) => resolve(directory)); | ||
| if (directories.length === 0) { | ||
| process.stderr.write("Usage: packet:run <run-dir> [<run-dir> β¦]\n"); | ||
| process.exit(2); | ||
| } | ||
| const written = await Promise.all( | ||
| directories.map(async (directory) => ({ | ||
| directory, | ||
| packet: await writeRunPacket(directory), | ||
| })), | ||
| ); | ||
| for (const { directory, packet } of written) { | ||
| const { summary } = packet; | ||
| process.stdout.write( | ||
| `${packet.label}: ${summary.exchanges} exchanges, median ${Math.round((summary.activePerExchangeMs.median ?? 0) / 1000)} s, ${summary.stepsPerExchange?.toFixed(1) ?? "β"} steps per exchange β ${resolve(directory, "evidence", "packet.md")}\n`, | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /** | ||
| * A run's analysable packet: per-exchange turn time split into hidden | ||
| * reasoning, argument streaming, reply text and tool phases, with the tool | ||
| * mix, skill activations, Ledger commit sizes, net growth and cost. Reads a | ||
| * persona run or turn-probe directory and writes `evidence/packet.json` and | ||
| * `evidence/packet.md` into it. | ||
| */ | ||
| import { mkdir, writeFile } from "node:fs/promises"; | ||
| import { join } from "node:path"; | ||
|
|
||
| import { | ||
| buildRunPacket, | ||
| type RunPacket, | ||
| } from "./run-packet/build-run-packet.ts"; | ||
| import { readRunDirectory } from "./run-packet/read-run-directory.ts"; | ||
| import { renderRunPacket } from "./run-packet/render-run-packet.ts"; | ||
|
|
||
| export type { RunPacket } from "./run-packet/build-run-packet.ts"; | ||
|
|
||
| export const writeRunPacket = async (directory: string): Promise<RunPacket> => { | ||
| const packet = buildRunPacket(await readRunDirectory(directory)); | ||
| const evidence = join(directory, "evidence"); | ||
| await mkdir(evidence, { recursive: true }); | ||
| await Promise.all([ | ||
| writeFile( | ||
| join(evidence, "packet.json"), | ||
| `${JSON.stringify(packet, null, 2)}\n`, | ||
| ), | ||
| writeFile(join(evidence, "packet.md"), renderRunPacket(packet)), | ||
| ]); | ||
| return packet; | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.