feat(cli): expose result_id + saved_path in --save --output-format json (sy-659)#480
Open
openclaw-dv wants to merge 1 commit into
Open
feat(cli): expose result_id + saved_path in --save --output-format json (sy-659)#480openclaw-dv wants to merge 1 commit into
openclaw-dv wants to merge 1 commit into
Conversation
…on (sy-659) Closes #471 Panel runs with --save and --output-format json now include a stable machine-readable handle on stdout: { "result_id": "result-...", "saved_path": "/.../.synthpanel/results/result-....json", ... } Agents driving follow-up commands (report/inspect/analyze, MCP tools) can read the handle directly from the JSON payload instead of scraping the "Result saved: <id>" line from stderr. Human-oriented stderr output is unchanged. The persistence call moved ahead of emit() in both the main panel-run path and the ensemble (--models a,b) path so the handle can land in the JSON payload before it ships. Added a public get_result_path() helper in synth_panel.mcp.data so call sites derive the path through the canonical layout function instead of duplicating it. Tests: 3 new in TestPanelRunSave covering --save+json (single model and ensemble) and the no-save baseline. All 175 CLI tests pass.
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.
Closes #471
Summary
--save --output-format jsonnow emits a stableresult_id+saved_pathon stdout so agents can drive follow-up commands without scraping stderr.get_result_path()helper insynth_panel.mcp.datafor canonical path derivation.--models a,b) path.Result saved: <id>line on stderr is preserved.Shape
{ "message": "Panel complete", "rounds": [...], "result_id": "result-20260522-211748-a1b2c3", "saved_path": "/Users/you/.synthpanel/results/result-20260522-211748-a1b2c3.json" }Keys are omitted entirely when
--saveis not set, so the no-save JSON shape is unchanged.Why
GH issue #471 (P0, hermes-filed): agents running panels with
--saveneed a stable handle forreport/inspect/analyze/ MCP calls. Machine-readable output should not require scraping stderr or terminal prose.Implementation notes
The persistence call moved ahead of
emit()in bothhandle_panel_run()paths (main + ensemble) so the handle lands inextrabefore serialization. The path is computed via the newget_result_path()helper rather than duplicating_results_dir() / f"{rid}.json"at call sites — keeps the layout authoritative in one place.Test plan
ruff check .cleanruff format --check .cleanpytest tests/test_cli.py— 175 passed (8 inTestPanelRunSave, 3 new for sy-659)pytest tests/test_cli.py tests/test_mcp_data.py tests/test_mcp_server.py tests/test_sdk.py— 258 passed, 1 skippedtests/test_seed.pyrequireOPENROUTER_API_KEY)python scripts/check_site_cli_sync.py— OKpython scripts/render_site_markdown.pyproduces no diffNew tests:
test_save_json_output_includes_result_id_and_saved_path— single-modeltest_save_json_output_in_ensemble_mode_includes_handle— ensembletest_json_output_without_save_omits_result_id_and_saved_path— negative case