Repository navigation
Preserve Kiro headless conversations in canonical session artifacts - #67394
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Map CLI 2.27 tool statuses and buffered assistant answers, retain partial and orphan observations, and wire the declarative engine parser to canonical artifact persistence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Harness failure detection must distinguish trusted diagnostics from echoed untrusted transcript content.
1 open finding
What changed in this PR
Adds canonical session preservation for Kiro CLI 2.27 headless output.
Changes:
- Parses compact/legacy Kiro conversations into canonical events.
- Wires the parser into Kiro workflows and unified-session generation.
- Adds sanitized fixtures and end-to-end regression coverage.
Review result: One must-fix security issue allows echoed prompt or tool text to fabricate a failed session result.
| File | Description |
|---|---|
pkg/workflow/kiro_workflow_test.go |
Verifies parser wiring. |
actions/setup/js/parse_kiro_log.test.cjs |
Expands parser coverage. |
actions/setup/js/parse_kiro_log.cjs |
Implements compact Kiro parsing. |
actions/setup/js/kiro_session_pipeline.test.cjs |
Tests artifact projection. |
actions/setup/js/fixtures/kiro_ci_sessions.cjs |
Adds sanitized run fixtures. |
actions/setup/js/engine_log_parser.test.cjs |
Tests parser dispatch precedence. |
actions/setup/js/engine_log_parser.cjs |
Updates engine parser dispatch. |
.github/workflows/smoke-kiro.lock.yml |
Regenerates smoke workflow. |
.github/workflows/shared/kiro.md |
Configures and documents parsing. |
.github/workflows/engine-conformance-kiro.lock.yml |
Regenerates conformance workflow. |
.changeset/patch-kiro-canonical-session.md |
Records the patch release change. |
🧠 Review effort: Balanced
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs given pr-triage classified this as a bug_fix (Kiro 2.27 output previously unrecognized). Overall the work is careful: fixtures are sanitized from real CI runs, the new parseCompactKiroLog handles truncation/orphan/anonymous-completion edge cases thoughtfully, and coverage in parse_kiro_log.test.cjs / kiro_session_pipeline.test.cjs is thorough for the documented scenarios.
One format-detection bug flagged inline: the legacy-vs-compact heuristic in parseKiroLog can misroute a genuine 2.27 session into the legacy branch if the buffered assistant answer happens to start with a markdown blockquote (> ...) before the first [tool] line appears — this silently discards all tool/status structure into a single raw-text assistant message. No existing test exercises this ordering, so it slipped through.
📋 Key Themes & Highlights
Key Themes
- Format-detection fragility:
isLegacyObservation'sisAssistantLinecheck (^>) can fire before the compact-format[tool]signature is seen in the same buffered-answer window, causing a false legacy-mode classification for real 2.27 output.
Positive Highlights
- ✅ Fixtures sourced from real, sanitized Smoke Kiro CI runs (
kiro_ci_sessions.cjs) give strong confidence for the documented success/failure paths. - ✅ Orphan/anonymous completion handling, 200-byte truncation marking, and secret redaction are all exercised with targeted unit tests.
- ✅
kiro_session_pipeline.test.cjsvalidates the full bootstrap → canonical → unified-session round trip, not just the isolated parser.
@copilot please address the review comment above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 160.5 AIC · ⌖ 14.6 AIC · ⊞ 10.1K
Comment /matt to run again
Require the final matching harness cleanup and runner exit before promoting execution diagnostics; retain error-looking tool and assistant content and omit prompt echoes. Cover canonical/unified propagation and existing bridge filtering. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 6f67c3c
|
Use legacy tool signatures rather than quoted prose to select legacy layout inside a harness-framed execution. Preserve exact compact blockquote content and tool events without reinterpreting legacy heredoc text. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The blockquote fix was already addressed and resolved in 205c1aa. Locally merged latest main via |

Kiro CLI 2.27 headless output was not recognized by the existing plaintext parser, and the Kiro engine definition did not invoke its parser. Existing success and failed-workflow artifacts consequently contained no canonical conversation and reported
unrecognized_engine_login the unified session.Approach
agent-session.jsonlfor conclusion to project intousage/aw_session.jsonl.Evidence and limitations
Sanitized fixtures come from existing successful Smoke Kiro run 37862725262 and failed workflow run 37549851664. Full local replay retains all 11 starts/11 completions in the former and 9 starts/11 completions in the latter, including two orphan failures. Both Kiro processes exited zero; the failed workflow failed during log redaction, not engine execution.
These stdout samples do not expose structured reasoning, provider refusals, tool outputs, or token usage. Coverage for those canonical fields is synthetic and labeled accordingly. No workflows were triggered.
inputTruncatedis retained in the canonical artifact; preserving that marker in the shared unified projection remains a separate integration follow-up, while the exact preview text is retained here.Validation
Passed
make build,make fmt,make fmt-cjs,make lint-cjs,make recompile, and finalmake agent-report-progresswith impacted Go tests and full workflow drift checking. Focusedgo test ./pkg/workflow -run '^TestKiro' -count=1, TypeScript checking, and 46 JavaScript tests passed. Both full downloaded traces were replayed through production bootstrap and merger, with exact observation/payload reconciliation, deterministic serialization, and agent/unified schema validation.The isolated dispatcher prerequisite is commit
37c92717f9(original554397eb6f); Kiro-owned changes are separately identifiable asd143a98a94.