Skip to content

Preserve Kiro headless conversations in canonical session artifacts - #67394

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan-kiro-session-audit
Oct 10, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan-kiro-session-audit

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

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_log in the unified session.

Approach

  • Map compact tool announcements, observed completion/failure statuses, and buffered assistant answers to canonical events. Preserve anonymous concurrent and orphan completions without guessing IDs, success, or accounting.
  • Retain multiline commands, observed 200-byte truncated previews, partial legacy tool output, exact payload whitespace, and registered-secret redaction. Keep genuinely unknown observations as extensions.
  • Wire the Kiro engine's log parser and regenerate its smoke and conformance workflows so bootstrap writes agent-session.jsonl for conclusion to project into usage/aw_session.jsonl.
  • Include the isolated shared dispatcher prerequisite so attributed engine stdout takes precedence over canonical-looking JSON quoted inside commands.

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. inputTruncated is 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 final make agent-report-progress with impacted Go tests and full workflow drift checking. Focused go 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 (original 554397eb6f); Kiro-owned changes are separately identifiable as d143a98a94.

pelikhan and others added 2 commits October 9, 2026 23:05
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>
@pelikhan
pelikhan marked this pull request as ready for review October 10, 2026 10:25
Copilot AI balanced review requested due to automatic review settings October 10, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread actions/setup/js/parse_kiro_log.cjs Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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's isAssistantLine check (^> ) 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.cjs validates 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

Comment thread actions/setup/js/parse_kiro_log.cjs
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>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/parse_kiro_log.cjs:30): [/diagnosing-bugs] Format-detection bug: isLegacyObservation treats any ^> line as a legacy signature, so a Kiro 2.27 compact-format session whose buffered answer happens to start with a markdown blockquote (e.g. > some quoted text) before the first [tool] line gets misrouted into the legacy branch — all [tool] structure is then swallowed as raw text inside one assistant.message instead of being parsed into tool.execution_start/tool.execution_complete events. - Preserve Kiro headless conversations in canonical session artifacts #67394 (comment)
  3. Fix failing check JS Tests (shard 3/4) (FAILURE): https://github.com/github/gh-aw/actions/runs/38046137983/job/114196025522.

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
Sous-chef work: 99fc195661b90dc631a5960c0642aa21aa4812000fe92377f25629fbdc6e618e d4fabf293333aa3d7e23f456b36be2fd78028335473cb38aec913039af022577
Sous-chef state: 6e1bdd102fd80c61ad8ece8b0216927a3b0cd84ec06c338703924a4202ea6cc0

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 5.78 AIC · ⌖ 6.61 AIC · ⊞ 1K · ◷
Comment /souschef to run again

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>
@pelikhan
pelikhan merged commit e92cdb5 into main Oct 10, 2026
48 of 51 checks passed
@pelikhan
pelikhan deleted the pelikhan-kiro-session-audit branch October 10, 2026 11:07

Copilot AI commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

The blockquote fix was already addressed and resolved in 205c1aa. Locally merged latest main via make merge-main (a4a6555) and fixed the shard failure by preserving native error statusCode through unified payloads/types/schema (8d8cf6d). Shard 3/4 passes: 141 files, 5,018 tests passed, 7 skipped; 117 focused tests and final validation also pass. Publication was rejected with GH013. PR #67394 merged during this session and its branch cannot be recreated, so these local commits are unpushed; the status-code fix needs a follow-up. No CI was triggered.

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.

4 participants