fix: tier-2 parity — error_max_turns, control acks, invalid-model shape, thinking signature#15
Merged
Conversation
dn00
added a commit
that referenced
this pull request
Jun 10, 2026
…pe, thinking signature Closes the consumed-field parity gaps confirmed by replay against the 2026-06-09 goldens (PARITY-GAPS #2/#3/#14/#15/#16), and adds the parity-policy tiers to PARITY-GAPS.md (contract / consumed fields / on-demand / won't-fix). - --max-turns now counts assistant API rounds (SSE message_start) like native, not user prompts — a single prompt chaining tools can exhaust it. On exceeding: interrupt, then report result.error_max_turns (is_error, NO result field, num_turns = rounds) and exit 1, even in stream-json mode, whether or not the interrupt beat the turn's natural completion. The old prompt-count check remains as a fallback for backends without SSE. - Ack initialize (truthful payload: commands from transcript init, output_style, pid) and set_permission_mode (echo mode) using native's nested control_response shape {type, response: {subtype, request_id, response}}; migrated the interrupt ack from clarp's old flat shape. - Turn-level backend API errors report subtype "success" with is_error: true (invalid-model golden), not subtype "error"; emitResult decouples is_error from subtype and can omit the result field (error_max_turns has none). - Assembler accumulates signature_delta; thinking blocks are {type, thinking, signature} like native. - Exit code now reflects the last result's is_error on stdin-drain shutdown (native exits 1 after an invalid-model turn even though the stream ends normally).
dn00
added a commit
that referenced
this pull request
Jun 10, 2026
…pe, thinking signature Closes the consumed-field parity gaps confirmed by replay against the 2026-06-09 goldens (PARITY-GAPS #2/#3/#14/#15/#16), and adds the parity-policy tiers to PARITY-GAPS.md (contract / consumed fields / on-demand / won't-fix). - --max-turns now counts assistant API rounds (SSE message_start) like native, not user prompts — a single prompt chaining tools can exhaust it. On exceeding: interrupt, then report result.error_max_turns (is_error, NO result field, num_turns = rounds) and exit 1, even in stream-json mode, whether or not the interrupt beat the turn's natural completion. The old prompt-count check remains as a fallback for backends without SSE. - Ack initialize (truthful payload: commands from transcript init, output_style, pid) and set_permission_mode (echo mode) using native's nested control_response shape {type, response: {subtype, request_id, response}}; migrated the interrupt ack from clarp's old flat shape. - Turn-level backend API errors report subtype "success" with is_error: true (invalid-model golden), not subtype "error"; emitResult decouples is_error from subtype and can omit the result field (error_max_turns has none). - Assembler accumulates signature_delta; thinking blocks are {type, thinking, signature} like native. - Exit code now reflects the last result's is_error on stdin-drain shutdown (native exits 1 after an invalid-model turn even though the stream ends normally).
dn00
added a commit
that referenced
this pull request
Jun 10, 2026
…pe, thinking signature Closes the consumed-field parity gaps confirmed by replay against the 2026-06-09 goldens (PARITY-GAPS #2/#3/#14/#15/#16), and adds the parity-policy tiers to PARITY-GAPS.md (contract / consumed fields / on-demand / won't-fix). - --max-turns now counts assistant API rounds (SSE message_start) like native, not user prompts — a single prompt chaining tools can exhaust it. On exceeding: interrupt, then report result.error_max_turns (is_error, NO result field, num_turns = rounds) and exit 1, even in stream-json mode, whether or not the interrupt beat the turn's natural completion. The old prompt-count check remains as a fallback for backends without SSE. - Ack initialize (truthful payload: commands from transcript init, output_style, pid) and set_permission_mode (echo mode) using native's nested control_response shape {type, response: {subtype, request_id, response}}; migrated the interrupt ack from clarp's old flat shape. - Turn-level backend API errors report subtype "success" with is_error: true (invalid-model golden), not subtype "error"; emitResult decouples is_error from subtype and can omit the result field (error_max_turns has none). - Assembler accumulates signature_delta; thinking blocks are {type, thinking, signature} like native. - Exit code now reflects the last result's is_error on stdin-drain shutdown (native exits 1 after an invalid-model turn even though the stream ends normally).
…pe, thinking signature Closes the consumed-field parity gaps confirmed by replay against the 2026-06-09 goldens (PARITY-GAPS #2/#3/#14/#15/#16), and adds the parity-policy tiers to PARITY-GAPS.md (contract / consumed fields / on-demand / won't-fix). - --max-turns now counts assistant API rounds (SSE message_start) like native, not user prompts — a single prompt chaining tools can exhaust it. On exceeding: interrupt, then report result.error_max_turns (is_error, NO result field, num_turns = rounds) and exit 1, even in stream-json mode, whether or not the interrupt beat the turn's natural completion. The old prompt-count check remains as a fallback for backends without SSE. - Ack initialize (truthful payload: commands from transcript init, output_style, pid) and set_permission_mode (echo mode) using native's nested control_response shape {type, response: {subtype, request_id, response}}; migrated the interrupt ack from clarp's old flat shape. - Turn-level backend API errors report subtype "success" with is_error: true (invalid-model golden), not subtype "error"; emitResult decouples is_error from subtype and can omit the result field (error_max_turns has none). - Assembler accumulates signature_delta; thinking blocks are {type, thinking, signature} like native. - Exit code now reflects the last result's is_error on stdin-drain shutdown (native exits 1 after an invalid-model turn even though the stream ends normally).
dn00
added a commit
that referenced
this pull request
Jun 10, 2026
…pe, thinking signature Closes the consumed-field parity gaps confirmed by replay against the 2026-06-09 goldens (PARITY-GAPS #2/#3/#14/#15/#16), and adds the parity-policy tiers to PARITY-GAPS.md (contract / consumed fields / on-demand / won't-fix). - --max-turns now counts assistant API rounds (SSE message_start) like native, not user prompts — a single prompt chaining tools can exhaust it. On exceeding: interrupt, then report result.error_max_turns (is_error, NO result field, num_turns = rounds) and exit 1, even in stream-json mode, whether or not the interrupt beat the turn's natural completion. The old prompt-count check remains as a fallback for backends without SSE. - Ack initialize (truthful payload: commands from transcript init, output_style, pid) and set_permission_mode (echo mode) using native's nested control_response shape {type, response: {subtype, request_id, response}}; migrated the interrupt ack from clarp's old flat shape. - Turn-level backend API errors report subtype "success" with is_error: true (invalid-model golden), not subtype "error"; emitResult decouples is_error from subtype and can omit the result field (error_max_turns has none). - Assembler accumulates signature_delta; thinking blocks are {type, thinking, signature} like native. - Exit code now reflects the last result's is_error on stdin-drain shutdown (native exits 1 after an invalid-model turn even though the stream ends normally).
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 the tier-2 (consumed-field) parity gaps confirmed by replay — PARITY-GAPS #2/#3/#14/#15/#16 — and writes the parity policy (contract / consumed fields / on-demand / won't-fix-by-design) into
PARITY-GAPS.md. Independent of #12/#13/#14 (branched off main).Fixes, each verified live against the sonnet goldens
--max-turnssemantics — native's unit is assistant API rounds inside the agentic loop (golden: 1 user prompt,num_turns: 2), not user prompts. clarp now counts SSEmessage_startevents; on exceeding it interrupts, then reportsresult.error_max_turns(is_error, noresultfield,num_turns= rounds) and exits 1 even in stream-json mode — whether or not the interrupt beats the turn's natural completion. Prompt-count check kept as a fallback for backends without SSE.initialize(truthful payload: commands from transcript init, output_style, pid — not native's full account/models capabilities; documented as tier-4) andset_permission_mode(echoes{mode}) are acked in native's nested shape{type, response: {subtype, request_id, response}}. The interrupt ack migrated from clarp's old flat shape to the nested one.subtype: "success"withis_error: true(the golden's actual shape — the gap list had this wrong), notsubtype: "error".emitResultdecouplesis_errorfrom subtype and can omitresult.signature— the assembler accumulatessignature_delta; thinking blocks are{type, thinking, signature}like native (consumers replaying content to the API need it).is_errorresult the session exits 1 on stdin-drain (native does; clarp exited 0).Live verification (replay vs goldens, free)
error_max_turns,num_turns: 2, noresultfieldsuccess+is_error: trueresult_delta: 0Suite: 417 tests green (8 new; 6 pre-existing tests updated where they codified the old, non-native shapes).