Skip to content

feat(cli): include result_id + saved_path in --save JSON output (sy-659)#532

Merged
openclaw-dv merged 1 commit into
mainfrom
polecat/quartz-mpjy0sn2
May 24, 2026
Merged

feat(cli): include result_id + saved_path in --save JSON output (sy-659)#532
openclaw-dv merged 1 commit into
mainfrom
polecat/quartz-mpjy0sn2

Conversation

@openclaw-dv
Copy link
Copy Markdown
Collaborator

Summary

When --save runs with --output-format json, the stdout JSON now carries top-level result_id and saved_path keys so agents get a stable follow-up handle without scraping the stderr "Result saved" line or rediscovering the saved file. A checkpointed run additionally surfaces its run_id. The bug was ordering: emit() ran before the --save persistence block, so the handle was computed too late to reach stdout — the write now happens ahead of the text/json branch split (and before emit in the ensemble path).

Changes

  • src/synth_panel/cli/commands.py: move save_panel_result() ahead of the text/json branch split (single-model + ensemble paths); inject result_id + saved_path (and run_id when checkpointing) into emitted JSON; stderr hint still prints after stdout body
  • README.md: document the machine-readable result_id/saved_path handles in the --save section
  • tests/test_cli.py: 3 new tests covering single-model + ensemble JSON output and the no-save omission case

Test plan

  • tests/test_cli.py: covers single-model JSON, ensemble JSON, and no-save omission of the keys
  • Polecat reports: ruff check+format clean, full suite 3013 passed locally (coverage 86%)

References

Closes #471

When `--save` runs with `--output-format json`, the stdout JSON now carries
top-level `result_id` and `saved_path` keys so agents get a stable follow-up
handle without scraping the stderr "Result saved" line or rediscovering the
saved file. A checkpointed run additionally surfaces its `run_id`.

The bug was ordering: emit() ran before the --save persistence block, so the
handle was computed too late to reach stdout. The write now happens ahead of
the text/json branch split (and before emit in the ensemble path); the
human-facing hint still prints to stderr after the stdout body.

Documented the keys in the README --save section and added CLI tests covering
single-model + ensemble JSON output and the no-save omission case.

Closes #471

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@openclaw-dv openclaw-dv merged commit 9976283 into main May 24, 2026
19 checks passed
@openclaw-dv openclaw-dv deleted the polecat/quartz-mpjy0sn2 branch May 24, 2026 15:55
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.

[agent-ready] Include result_id and saved path in machine-readable CLI output

1 participant