Skip to content

Preserve indentation-sensitive prompt chunks in compiled YAML - #78624

Merged
pelikhan merged 11 commits into
mainfrom
copilot/fix-invalid-lock-file
Nov 17, 2026
Merged

pelikhan merged 11 commits into
mainfrom
copilot/fix-invalid-lock-file

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Prompt chunks beginning with indentation can become invalid bare YAML literals during re-marshaling. Literal encoding can also silently lose whitespace, including newline-only chunks.

  • Safe serialization: Quote multiline values vulnerable to indentation inference or whitespace loss. Retain ordinary literal formatting without trimming content or moving chunk boundaries.
  • Pre-emission integrity: Parse encoded prompt steps and compare every GH_AW_PROMPT_CONTENT_* value with its intended text. Reject malformed or altered output before emission.

Indentation-sensitive content is represented as an escaped scalar:

env:
  GH_AW_PROMPT_CONTENT_0006: "   Continuation text\n145. Step 145: continue\n"

@pelikhan pelikhan changed the title [WIP] Fix invalid lock file issue for prompt chunk indentation Preserve indentation-sensitive prompt chunks in compiled YAML Nov 17, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 17, 2026 05:53
Copilot AI adaptive review requested due to automatic review settings November 17, 2026 05:53
@github-actions

github-actions Bot commented Nov 17, 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 by Ponytail Reviewer for #78624 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.7K · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

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

Generated by PR Specification Reviewer for #78624 · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-085f2657-82d7-4952-a2a9-316fa92a30d4","parents":[],"payload":{"id":"ldg-f6a1d110-b712-47db-a654-e4e81a72760f","operation":"append","value":{"finding_count":0,"head_sha":"46cfa061efbe019852b5ab82b8172ba797b1e074","outcome":"aligned"}},"sha":"sha256:30d6dae6ef444a0b6417e6f716108a7fac108c07b3b32e77b48fd426bb6bf7e5","timestamp":"2026-11-17T06:00:08.182Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-17T05:56:09Z
review_event: REQUEST_CHANGES
top_themes:
  - trailing multiline YAML whitespace repair is discarded
files_reviewed:
  - pkg/workflow/yaml_options.go
  - pkg/workflow/credential_free_prompt.go
  - pkg/workflow/yaml_options_test.go
comment_count: 1
History

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 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.5K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (210 new lines under pkg/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/78624-preserve-indentation-sensitive-prompt-chunks.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 committed to this branch. It was generated from the PR diff.

  2. Complete the missing sections. Add context the gate could not infer, confirm the rationale marked [TODO: verify], and keep only the alternatives you actually considered.

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

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

    ADR: ADR-78624: Preserve Indentation-Sensitive Prompt Chunks in Compiled YAML (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate re-runs and verifies that the implementation matches the decision.

🔍 Gate evidence

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
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.

Request changes: the new YAML repair path does not actually preserve trailing blank lines unless another unrelated value triggers the AST serialization path. This can silently alter prompt content during compilation.

Highlights
  • Fix the repaired flag so the trailing-blank-line mutation is not discarded.
  • Add coverage where the trailing-blank-line case is the only repair needed.
  • Static review only; tests were not run.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.5K
Comment /review to run again

Comment thread pkg/workflow/yaml_options.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-a4c99d22-e926-4439-b14b-2ef044e66e27","parents":[],"payload":{"id":"ldg-b2dd7291-c191-4a32-a9c9-406981674661","operation":"append","value":{"finding_count":1,"head_sha":"46cfa061efbe019852b5ab82b8172ba797b1e074","outcome":"findings"}},"sha":"sha256:74fdf3ad8fdf53d63f4a7c8eda417d687881811fb34eb2336ae194dbb27eee53","timestamp":"2026-11-17T06:00:57.155Z","type":"ledger_append","version":1}
History

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.

🔵 Needs a closer look

Conditional AST re-encoding affects shared serialization across multiple compiler paths, requiring broader semantic review to assess preservation of scalar values, comments, whitespace, and sequence indentation.

No open issues 🎉

What changed in this PR

This PR addresses #76963 by preserving indentation-sensitive prompt chunks when gh-aw compiles workflows into GitHub Actions YAML, without trimming content or changing chunk boundaries.

Changes:

  • Adds shared YAML serialization that quotes whitespace-sensitive multiline values while retaining ordinary literal formatting.
  • Validates prompt content after serialization and before emission, rejecting malformed YAML or altered values.
  • Adds regression tests for indented chunks, whitespace preservation, and round-trip validation failures.
File Description
pkg/​workflow/​yaml.go Uses safe serialization for field-ordered YAML.
pkg/​workflow/​yaml_options.go Adds whitespace-preserving multiline serialization.
pkg/​workflow/​yaml_options_test.go Tests round trips with two YAML parsers and formatting compatibility.
pkg/​workflow/​workflow_import_merge.go Applies safe serialization to merged services.
pkg/​workflow/​runs_on_snippet.go Applies safe serialization to runner snippets.
pkg/​workflow/​run_step_sanitizer.go Preserves sensitive multiline values when re-serializing steps.
pkg/​workflow/​frontmatter_extraction_yaml.go Uses safe serialization for extracted YAML sections.
pkg/​workflow/​credential_free_prompt.go Safely serializes prompt steps and validates content before emission.
pkg/​workflow/​credential_free_prompt_test.go Tests indented prompt chunks and validation failures.
pkg/​workflow/​compiler_yaml_step_conversion.go Uses safe serialization when converting step maps.
pkg/​workflow/​compiler_custom_job_execution.go Uses safe serialization for custom-job fields.

Review effort: Balanced (adaptive)

@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, /tdd, and /grill-with-docs. Requesting changes: the indentation fix works for the common case, but a dead branch and a single-line whitespace gap mean some values still change on round trip.

📋 Key Themes & Highlights

Key Themes

  • Dead branch: the trailing-blank-line branch in marshalYAMLWithOptions never sets repaired, so output depends on sibling values.
  • Single-line whitespace gap: a single-line value with a leading tab is emitted as a plain scalar and does not round-trip. New tests only cover multiline values.
  • Validator scope: validatePromptContentRoundTrip checks re-marshal stability, not the original chunk text.
  • Pre-existing failure: TestCredentialFreePromptEnvironment injects GITHUB_TOKEN and then asserts it is absent. The failing lines are not in this PR, so this is not a regression from it, but it should be fixed or tracked separately.

Positive Highlights

  • ✅ Comment preservation survives the repaired path (# v9.0.0 kept).
  • ✅ Indentation matches the plain path (ports: / - 5432:5432), so no layout regression.
  • ✅ gofmt is clean and the new TestCredentialFreePromptPreservesIndentedChunks passes.
  • ✅ The DefaultMarshalOptions consistency test was extended to cover sibling-triggered repair.

Skill selection: triage output was not used, so skill selection followed the inline guidance directly.

@copilot please address the review comments above.

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

Comment thread pkg/workflow/yaml_options.go Resolved
Comment thread pkg/workflow/yaml_options.go Resolved
Comment thread pkg/workflow/credential_free_prompt.go Resolved
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/yaml_options.go:44): address unresolved feedback - Review comment
  3. Review (pkg/workflow/yaml_options.go:46): address unresolved feedback - Review comment
  4. Review (pkg/workflow/yaml_options.go:37): address unresolved feedback - Review comment
  5. Review (pkg/workflow/credential_free_prompt.go:184): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "0868e331851ae6918982470ca96d435370927f9a",
  "kind": "requested",
  "schema_version": "1",
  "state": "0e872e6187a652c7bf6652d691bc34d14bfc199dcf572dc8c13d22b1e80ba5ad",
  "work": [
    "02bee0af83a701a8793c4b808f54aa7f18c76f25a6dba559c526979c7046b048",
    "a4c47f646d0bf82b594675b1c7174581cad35a7f77aaa4072ad3dcf95d2b7d11",
    "dc1088bc94ebbfcd4f3efa02158d8309b64550f25c412beb6f48f500001e21c1",
    "fe0d4561245ac251e86314998185d23018f6c4cb49d73b16c144c242d60bc72d"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 3 commits November 17, 2026 06:46
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@pelikhan

Copy link
Copy Markdown
Collaborator Author

@copilot fix ci failures

Copilot AI commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged main using make merge-main in d21dbaa and verified all four linked fixes from 7b64d02. Replied to each thread. Refreshed goldens and compiled workflows in 049b6b1; focused tests, native/WASM golden tests, and workflow drift checks pass.

@copilot fix ci failures

Fixed in 049b6b1: regenerated stale WASM goldens and workflow locks. Merging main in d21dbaa also brought in the overflow-test correction. CGO passed on that revision: https://github.com/github/gh-aw/actions/runs/44134351322. Local focused/WASM tests and drift checks pass. The final local gate reports unrelated existing custom-linter findings; CodeQL timed out.

@pelikhan
pelikhan merged commit c284528 into main Nov 17, 2026
86 checks passed
@pelikhan
pelikhan deleted the copilot/fix-invalid-lock-file branch November 17, 2026 17:50
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.1

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.

Compile emits invalid lock file when a prompt chunk starts with an indented line (bare literal block scalar)

4 participants