Repository navigation
Conversation
|
| total_cost_usd: 1.25, num_turns: 3, usage: {input_tokens: 11, | ||
| cache_read_input_tokens: 22, cache_creation_input_tokens: 33, output_tokens: 44}}; | ||
| const final = JSON.parse(JSON.stringify(success)); | ||
| const variant = process.argv[2]; | ||
| const events = [null, {type: "system"}, success]; | ||
| if (variant === "missing") events.pop(); | ||
| if (variant === "subtype") final.subtype = "error_during_execution"; | ||
| if (variant === "is-error") final.is_error = true; | ||
| if (variant === "incomplete") delete final.usage.output_tokens; | ||
| if (["subtype", "is-error", "incomplete"].includes(variant)) events.push(final); | ||
| if (variant === "trailing") events.push({type: "system"}, null); |
There was a problem hiding this comment.
Synthetic arrays leave format unverified
Every verbose array in this test is built from a result object the test also creates. That checks the parser against the assumed event shape, but it could pass even if Claude's actual verbose output still fails to parse. A captured verbose response or an opt-in live-engine case would cover the format this fix is meant to support.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Speaking as Kun's firstmate: VISION.md per-rule
contract-class: restore — unconfigured path already counted Claude engine turns via Waiting on you (not a captain hold): |
6ad63f5 to
806ca88
Compare
|
Speaking as Kun's firstmate: re-stamp after head moved to Attestation: MISSING (body still says no contract-class: restore — unconfigured path already counted Claude engine turns via VISION (per-rule)
Waiting on you: |
…s an array Claude's verbose output returns a turn as a JSON array of events, which the supervision engine rejected. Read the last result event from such an array, keeping the completeness checks and cost accounting. Closes kunchenguid#6194
806ca88 to
2cb301c
Compare
|
Speaking as Kun's firstmate: re-stamp for the new head Tip check: main Gates on this head:
contract-class: restore (unchanged). The default path already counts Claude engine turns through this parser. Verbose array output was being miscounted as failed. Plain objects behave as before. VISION (per rule): unchanged. One captain/one interface (no false failed-turn wakes), authority explicit, scripts own the mechanics, restart is a non-event, delegation with a spine, fleet outlives any vendor (it reads both shapes the vendor emits), and scope all align. What unblocks it: run |
Fixes #6194.
When the supervision host's Claude engine runs with verbose settings,
--output-format jsonprints a JSON array of events instead of one result object.fm_supervision_engine_resultonly accepted an object, so every such turn was counted as failed even though the result event at the end of the array was complete.For an array, the parser now uses the last event with
type: "result". Every existing completeness check (error flag, subtype, usage fields, turn count, cost accounting) still runs on that event. An array with no result event fails the turn, and so does an earlier success followed by a failed or incomplete final result. Plain objects behave as before. I updated the function comment anddocs/supervision-host.mdto match.Tested:
test_engine_result_objects_and_verbose_arraysintests/fm-supervision-host.test.shpasses. It covers a plain object, a verbose array, trailing non-result events, a missing result, and an error, non-success or incomplete final result after an earlier success.shellcheckon the two changed shell files is clean.Not run:
bin/fm-lint.sh(the full lint was too slow in my environment). The box has Node 20, and the rest of the host suite hit unsupported.tsloading.git push no-mistakesattestation yet. This PR was prepared on the fork and I will push it throughno-mistakesmyself, so the attestation check will fail until then.