From caee942922c486106276cac1833cd3a266b408fc Mon Sep 17 00:00:00 2001 From: abrichr Date: Sun, 18 Oct 2026 15:31:20 -0400 Subject: [PATCH 1/2] feat(flow): Meta-Harness-style trace export for GUI rollouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds openadapt_flow.integrations.harness2.traces. It writes a filesystem an outer-loop proposer can read: every candidate's harness, and for each rollout the full trace (every screen, action, reason and error), the identity verdict at each write, and the read-back from the system of record with the reward. - from_rollout reads an agent rollout; the identity at a write comes from the patient banner the agent was looking at. - from_flow_run reads a compiled program's report.json, keeping the runtime's own identity-gate verdicts and effect checks. - Screen text is scrubbed like REPORT.md; verdicts are computed first. - run_task writes the export for every task. In readback mode the identity verdict also appears in the trajectory Harness² proposers read. Co-Authored-By: Claude Opus 5.5 --- packages/flow/docs/HARNESS2.md | 35 ++ .../integrations/harness2/adapter.py | 17 +- .../integrations/harness2/selection.py | 18 +- .../integrations/harness2/traces.py | 423 ++++++++++++++++++ packages/flow/tests/test_harness2_adapter.py | 14 + packages/flow/tests/test_harness2_traces.py | 143 ++++++ 6 files changed, 648 insertions(+), 2 deletions(-) create mode 100644 packages/flow/openadapt_flow/integrations/harness2/traces.py create mode 100644 packages/flow/tests/test_harness2_traces.py diff --git a/packages/flow/docs/HARNESS2.md b/packages/flow/docs/HARNESS2.md index 9bd65d9ef..41200fe9a 100644 --- a/packages/flow/docs/HARNESS2.md +++ b/packages/flow/docs/HARNESS2.md @@ -93,6 +93,41 @@ end with Harness²'s recursion code: `k` base rollouts, one mode (`seq` or `agg`), selection by reward or by Harness²'s model selector, and the read-back of the chosen run. +## Trace export + +Meta-Harness ([arXiv:2603.28052](https://arxiv.org/abs/2603.28052)) gives +its proposer a filesystem with every earlier candidate's harness, full +execution traces and scores. In its ablation, full traces beat summaries, +56.7 to 38.7. `openadapt_flow.integrations.harness2.traces` writes that +filesystem for GUI work. `run_task` writes one for every task under +`/traces`. + +``` +traces/INDEX.md one line per trace, best reward first +traces/index.jsonl the same, one JSON object per trace +traces/candidates/