Skip to content

Fix CI prompt contracts and YAML scalar round trips - #74058

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan/fix-ci-failures-564
Nov 2, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan/fix-ci-failures-564

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Main CI and CGO runs were failing on outdated prompt-loading assertions, missing merge-guard diagnostic guidance, and a YAML source-editing defect. This restores those contracts without reverting the author-file prompt boundary or weakening merge guards.

Changes

  • Preserve complete keep-chomping scalar values, including excess-indented trailing whitespace, after syntax merging rather than during indentation shifts. Use lossless snapshots for source-edit inputs and retain strict semantic validation.
  • Share the structured prompt-render-plan test helper across unit and integration builds, and assert compiler-selected author files instead of obsolete self-import macros.
  • Give the Pi prompt-rendering fixture a real workflow directory and workspace, and update the cache-memory assertion for current YAML quoting.
  • Document missing merge-guard codes and require checking current PR head/base/checks/reviews/guards before acting, while retaining the playbook's word and byte limits.

ADR: ADR-74058: Rebuild Keep-Chomping Scalar Newlines After Source Merging. Completed proposal; maintainer approval is not recorded.

Validation

  • make build and make fmt
  • make test-guidance (60 tests)
  • go test ./pkg/workflow/actions ./pkg/workflow/codemod -count=1, including edits across all 395 repository workflows and new scalar-whitespace regressions
  • Focused workflow and CLI integration tests covering Pi transport, runtime imports, template expressions, cache memory, and Sentry prompt contracts
  • Impacted Go unit tests from make agent-report-progress; final lint, schema, and workflow-drift checks passed with make agent-report-progress-no-test after correcting custom-linter diagnostics

@pelikhan
pelikhan marked this pull request as ready for review November 2, 2026 13:19
Copilot AI adaptive review requested due to automatic review settings November 2, 2026 13:19
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · ~9 AIC · ⌖ ~8 AIC · ⊞ 15.1K · ◷

Generated by Ponytail Reviewer for #74058

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · sonnet50 · ~14 AIC · ⊞ 12.7K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR has more than 100 new lines in business logic directories (230 in pkg/), and its body does not link an Architecture Decision Record (ADR).

The design decision is in pkg/workflow/actions/source_scalar.go and source.go. Keep-chomping (|+ / >+) trailing-newline reconstruction now happens in a new post-merge AST pass (preserveSourceLiteralNewlines) instead of the indentation-shift visitor.

📄 Draft ADR committed: docs/adr/74058-reconstruct-keep-chomping-scalars-after-source-merge.md. Review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR on your branch. It was generated from the PR diff.

  2. Complete the missing sections. Add context that could not be inferred from the diff, refine the decision rationale, and list the alternatives you actually considered. Also confirm the deciders, which are marked [TODO: verify].

  3. Commit the finalized ADR to docs/adr/ on your branch.

  4. Reference the ADR in this PR body with a line such as:

    ADR: ADR-74058: Rebuild Keep-Chomping Scalar Newlines After Source Merging (link unavailable: invalid HTTPS URL)

Once the PR body links an ADR, this gate will re-run and check that the implementation matches the decision.

❓ Why ADRs Matter

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors, including your future self, can find the reasoning instead of reconstructing it.

📋 Michael Nygard ADR Format Reference

An ADR is complete only if it has these four sections:

  • Context: What is the problem, and what constraints apply?
  • Decision: What did you decide, and why?
  • Alternatives Considered: What else could have been done?
  • Consequences: What are the trade-offs, positive and negative?

ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: opus55 medium · ~26 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷
Comment /review to run again

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-02T13:22:46Z
review_event: REQUEST_CHANGES
top_themes:
  - merge-guard live-state safety guidance removed
  - keep-chomping scalar whitespace loss
files_reviewed:
  - .github/aw/debug-playbook.md
  - pkg/workflow/actions/source_scalar.go
  - pkg/workflow/actions/source.go
  - pkg/workflow/actions/source_scalar_test.go
  - pkg/cli/portfolio_analyst_workflow_contract_test.go
  - pkg/workflow/prompt_render_plan_test.go
comment_count: 2

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~5 AIC · ⊞ 1.7K · ◷
Comment /review to run again

@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.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Request changes

Two actionable regressions need correction before merge.

Findings
  • The debug playbook drops the live PR-state reconciliation step, weakening merge-guard safety guidance.
  • The scalar rewrite discards excess whitespace on trailing keep-chomping lines, risking data changes during unrelated edits.

The specialist pass completed; its additional speculative/performance concerns were not included. Static review only; tests were not run.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~5 AIC · ⊞ 1.7K
Comment /review to run again

Comment thread .github/aw/debug-playbook.md Resolved
Comment thread pkg/workflow/actions/source_scalar.go Resolved

@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.

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Skills-Based Review 🧠

Applied /diagnosing-bugs, /tdd, and /codebase-design. The core keep-chomping fix is solid: I confirmed the base commit rejects an untouched |+ literal (edited YAML source does not match the requested AST) and the PR head preserves parsed values for untouched, tail, and nested-sequence cases. Leaving as a comment with follow-ups, not a blocker.

📋 Anchor corrections and key themes

Anchor corrections (two inline comments landed on adjacent lines):

  • The sequence followingBlankLine note belongs at pkg/workflow/actions/source_scalar.go lines 61 and 72, not 104.
  • The shifted-indent suffix note belongs at source_scalar.go line 109, not 108.
  • The removed model/engine link is at base .github/aw/debug-playbook.md line 149 (LEFT side), not 77.

Key themes

  • Shifted-indent coverage gap: preserveSourceLiteralSuffix reuses sourceLiteralIndent(origin); add a test where an enclosing edit re-indents a keep-chomping literal.
  • Fragile sequence check: the followingBlankLine logic depends on Node.String() prefixes; document the invariant or add a comment/CRLF regression case.
  • Silent fallback in test helper: promptRenderPlan retries the jobs shape on any unmarshal failure, so a wrong shape can pass quietly.
  • Playbook budget: the playbook is at its 26000-byte guidance limit at HEAD, so restoring the removed link may require trimming elsewhere.

Positive highlights

  • ✅ The post-merge fixup in emitWithValidation covers both emit and EditSource paths, including scalar replacement.
  • ✅ New TestEditSourcePreservesKeepChompingScalars covers nested mappings, sequences, folded scalars, and CRLF (26 subtests pass).

@copilot please address the review comments above.

Comments that could not be inline-anchored

pkg/workflow/actions/source_scalar.go:104

**[/diagnosing-bugs]** The `followingBlankLine` decision for sequence children relies on `strings.HasPrefix(value.Values[next].String(), "\n")`. That makes the fix depend on how a node stringifies, not on token positions, so comments or CRLF in the source could flip the result silently. <details> <summary>💡 Suggestion</summary> Add a regression case where a keep-chomping literal is followed by a comment line and then a blank line, in both mapping and sequence form, and assert the output round...

pkg/workflow/actions/source_scalar.go:108

**[/tdd]** `preserveSourceLiteralSuffix` appends the trailing blank lines using `sourceLiteralIndent(origin)`, computed from the original literal. I checked untouched, tail, and nested-sequence keep-chomping literals and they round-trip, but there is no test for a literal whose indentation was shifted by an enclosing edit. <details> <summary>💡 Suggested test</summary> Add a table case that re-indents a keep-chomping literal (for example, moving it under a deeper mapping) and asserts the parse...

pkg/workflow/actions/source.go:105

**[/codebase-design]** The new `preserveSourceLiteralNewlines(body.Body, false)` runs once for the whole emitted body, and both `emit` and `EditSource` route through `emitWithValidation`, so every path is covered. Good. The `false` argument hard-codes that the top-level document has no following blank line. A short comment on why the top level is always `false` would help future readers. @copilot please address this.

pkg/workflow/prompt_render_plan_test.go:28

**[/tdd]** If `yaml.Unmarshal` into `[]promptStep` fails, the helper silently retries as the workflow-jobs shape. A malformed or wrong-shape output can therefore pass with an empty or incorrect env instead of failing on the shape mismatch. <details> <summary>💡 Suggested fix</summary> Detect the shape first (for example, check for a top-level `jobs` key), or assert that the steps list is non-empty after the fallback, so an unexpected shape fails loudly. </details> @copilot please address thi...

.github/aw/debug-playbook.md:77

**[/codebase-design]** This removes the only link from the "Compare one success" section to `debug-model-engine-misconfiguration.md`, while the guide itself still exists and is linked from three other rows. Please confirm the removal was intentional. The playbook also sits at its 26000-byte guidance limit at HEAD, so adding the link back may need wording trimmed elsewhere. @copilot please address this.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⊞ 5.4K
Comment /matt to run again

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

Scalar round-tripping can discard content-bearing whitespace or add extra blank lines before comments, causing unrelated edits to fail semantic validation.

2 open issues
What changed in this PR

Updates gh-aw’s CI test contracts for author-file prompt loading and adjusts YAML source editing to preserve keep-chomping scalar values after syntax merging.

Changes:

  • Share prompt-render test helpers and align fixtures and assertions with compiler-selected author files.
  • Move scalar newline preservation after syntax merging and add round-trip regression cases.
  • Expand merge-guard diagnostic guidance while retaining the playbook’s size limits.
File Description
pkg/​workflow/​unified_prompt_creation_test.go Removes the helper moved into a shared test file.
pkg/​workflow/​template_expression_integration_test.go Checks author-file prompt configuration.
pkg/​workflow/​runtime_import_expansion_integration_test.go Updates prompt-loading assertions and import comments.
pkg/​workflow/​prompt_render_plan_test.go Provides the shared structured prompt-plan helper.
pkg/​workflow/​pi_safe_outputs_transport_integration_test.go Gives the fixture a workflow directory and workspace.
pkg/​workflow/​cache_memory_integration_test.go Updates the expected YAML quoting.
pkg/​workflow/​actions/​source.go Runs newline preservation after syntax merging.
pkg/​workflow/​actions/​source_scalar.go Reworks keep-chomping scalar suffix handling.
pkg/​workflow/​actions/​source_scalar_test.go Adds scalar round-trip regression cases.
pkg/​cli/​portfolio_analyst_workflow_contract_test.go Verifies the configured author file preserves the prompt guard.
.github/​aw/​debug-playbook.md Adds merge-guard codes and condenses guidance.

Review effort: Max (auto)

Comment thread pkg/workflow/actions/source_scalar.go Resolved
Comment thread pkg/workflow/actions/source_scalar.go Resolved
Address PR review feedback with lossless source-edit snapshots, whitespace regression coverage, live PR-state reconciliation, and a completed proposed ADR.

Co-authored-by: Copilot App <[email protected]>
@pelikhan

pelikhan commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

In response to the review-start notification:

No code change is needed for this status-only notification. The actionable findings are addressed in their corresponding review threads.

@pelikhan

pelikhan commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

In response to the Ponytail Reviewer result:

No code change is requested by this notification, and I have not treated the no-op result as proof of completed validation or publication. The fixes were checked independently before being pushed.

@pelikhan

pelikhan commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

In response to the Test Quality Sentinel result:

Acknowledged the incomplete threat-detection analysis; this is a tooling failure, not a clean result or a security finding. This status-only notice does not identify a code change; the scalar regression suite and guidance checks were run independently.

@pelikhan

pelikhan commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

In response to the PR Code Quality Reviewer result:

Accepted and fixed the concrete live-state and scalar-preservation findings in their inline threads. The failed threat-detection analysis remains unavailable, not a security verdict.

@pelikhan

pelikhan commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

In response to the Design Decision Gate notification:

Reviewed and completed the generated ADR with the implemented design and actual alternatives considered, preserving the automation's commit. Its status is Proposed pending maintainer review, with no approval or unverified deciders attributed.

@pelikhan

pelikhan commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

In response to the ADR requirement:

Completed ADR-74058 with context, decision, actual alternatives, consequences, and the significant-whitespace invariant, and linked it in the PR body. It remains Proposed pending maintainer review rather than recording approval that has not occurred.

@pelikhan

pelikhan commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

In response to the managed review summary:

Both recorded findings are addressed: the live PR-state check is restored and excess-indented scalar whitespace is preserved with regression coverage. I left the managed memory unchanged and have not treated the threat-detection failure as a security verdict.

Retain block mappings and plain keys in EditSource snapshots while JSON-quoting multiline scalars. Preserve semantic validation, cover inserted mapping layout and scalar suffix whitespace, and update ADR-74058.

Co-authored-by: Copilot App <[email protected]>
@pelikhan
pelikhan merged commit 0c5004a into main Nov 2, 2026
37 checks passed
@pelikhan
pelikhan deleted the pelikhan/fix-ci-failures-564 branch November 2, 2026 14:19
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants