feat(simulate): export a run as JSON with --export - #925
Open
u9g wants to merge 12 commits into
Open
Conversation
The hand-written export structs mirrored the proto by hand and would drift on every proto change. Emit the SimulationRun and decoded SimulationRunSummary verbatim via protojson (proto field names) under a thin version wrapper.
protojson round-trip is the library's invariant, not ours; the test no longer covered code this package owns.
It printed back the command the user had just typed.
theomonnom
reviewed
Aug 4, 2026
theomonnom
approved these changes
Aug 4, 2026
--run-json rode along with a live run or a --view poll, so exporting a finished run's JSON meant waiting on machinery that had nothing to do with the export. --dump-json takes the run ID directly and does one fetch: an unfinished run is an error, an unknown ID is the API's not-found error, and stdout carries the JSON or nothing.
A proto3 implicit-presence bool is indistinguishable from unset once protojson omits it, so a consumer reading a dropped is_error has to guess.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds
--export RUN_IDtolk agent simulate: prints an existingSimulationRunto stdout as JSON, so a run can be replayed or diffed programmatically.--view,--scenarios,--audio,-n,--concurrency,--agent-name) are rejected rather than silently dropped;--quietand--yesstill work, since the export goes to stdout and only status output is silenced.{version, run, summary}wrapper, so new proto fields reach the export on a protocol bump alone, with no change here. Fields the compiled protocol does not know are still dropped —protojsondoes not emit unknown fields — so an oldlkagainst a newer server exports less than the wire carried.summary_zstdis dropped since the decoded summary is already included, and a summary that fails to decode fails the export instead of silently vanishing.summary.chat_historykeyed by job ID, in proto form: oneof-wrapped items,SCREAMING_CASEenums, RFC3339 timestamps. That is notChatContext.to_dict()shape, so a replay harness needs a translation step on the way in.--viewprint the export hint. In--viewthe re-open hint is suppressed — it would just echo the command the user ran.