Skip to content

fix(#2187): normalize fix instruction line endings - #7073

Merged
rh-hemartin merged 3 commits into
fullsend-ai:mainfrom
shairevivo:srevivo/2187-strip-fix-crlf
Sep 8, 2026
Merged

fix(#2187): normalize fix instruction line endings#7073
rh-hemartin merged 3 commits into
fullsend-ai:mainfrom
shairevivo:srevivo/2187-strip-fix-crlf

Conversation

@shairevivo

@shairevivo shairevivo commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Normalize CRLF comment bodies before forwarding human instructions to the
supported per-repo fix agent. This prevents invisible carriage-return bytes
from reaching the agent while preserving the comment's line structure.

The deprecated per-org reusable-fix.yml path is intentionally unchanged in
accordance with ADR 0044. That path retains the same latent CRLF exposure,
which is accepted as follow-up work under the deprecation timeline; this PR
adds no new per-org behavior.

Related Issue

Fixes #2187

Changes

  • strip \r from fix comment bodies in the inline per-repo fix stage
  • execute the real workflow step in a regression test with a CRLF payload
  • assert that the generated instruction contains only LF line endings
  • document the accepted deprecated per-org path limitation

Testing

Checklist

  • PR title follows Conventional Commits
  • Commits are signed off (DCO)
  • I wrote this contribution myself and can explain all changes in it

Strip carriage returns from comment bodies before forwarding human
instructions to the supported per-repo fix agent.

Exercise the real workflow step with a CRLF event payload.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Shai Revivo <srevivo@redhat.com>
@shairevivo
shairevivo requested a review from a team as a code owner September 7, 2026 10:20
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for org/repo members and collaborators on pull requests.

For other contributors, a maintainer must add the ok-to-test label after the latest push.

See E2E testing guide for details.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Normalize fix instruction line endings

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Removes carriage returns from per-repository fix comments before agent forwarding.
• Preserves LF-separated instruction structure for reliable fix-agent prompts.
• Executes the real workflow shell step against a CRLF regression payload.
Diagram

sequenceDiagram
  actor Contributor
  participant GitHub as GitHub Event
  participant Dispatch as Reusable Dispatch
  participant Normalize as CRLF Normalizer
  participant Output as GitHub Output
  participant Agent as Fix Agent
  Contributor->>GitHub: Submit fix comment
  GitHub->>Dispatch: Send event payload
  Dispatch->>Normalize: Extract comment body
  Normalize-->>Dispatch: Return LF instruction
  Dispatch->>Output: Write instruction
  Output->>Agent: Forward instruction
Loading
High-Level Assessment

The current approach is appropriate: normalizing at comment extraction removes CR bytes before subsequent parsing while preserving LF line structure. It also limits the behavior change to the supported per-repository workflow, leaving the deprecated per-organization path unchanged as required by ADR 0044.

Files changed (2) +54 / -1

Bug fix (1) +1 / -1
reusable-dispatch.ymlNormalize fix comment line endings during extraction +1/-1

Normalize fix comment line endings during extraction

• Pipes extracted comment bodies through 'tr -d '\r'' before parsing '/fs-fix' instructions. This prevents carriage-return bytes from reaching the supported per-repository fix agent while retaining multiline LF structure.

.github/workflows/reusable-dispatch.yml

Tests (1) +53 / -0
workflow_call_alignment_test.goAdd executable CRLF instruction regression coverage +53/-0

Add executable CRLF instruction regression coverage

• Loads and executes the workflow's real context-extraction shell step with a CRLF comment payload. Stubbed dependencies make the output deterministic, and assertions verify the resulting instruction uses only LF line endings.

internal/scaffold/workflow_call_alignment_test.go

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@rh-hemartin

Copy link
Copy Markdown
Member

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 7, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:18 PM UTC · Completed 1:34 PM UTC

Commit: 83cfe9b · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.36

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Sep 7, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Small, well-tested fix to a low-priority latent CRLF bug offset by high churn and multi-author contention on the touched CI workflow file.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [protected-path] .github/workflows/reusable-dispatch.yml — This PR modifies a file under the protected .github/ path. The change is linked to issue Strip CRLF from COMMENT_BODY in reusable-fix.yml (latent bug) #2187 and the PR description provides clear rationale (CRLF normalization bug fix). Human approval is always required for protected-path changes, regardless of context.

Low

  • [scope-vs-issue] .github/workflows/reusable-dispatch.yml:1100 — Issue Strip CRLF from COMMENT_BODY in reusable-fix.yml (latent bug) #2187 cites the bug at .github/workflows/reusable-fix.yml:227, but the fix is applied to the inlined fix job inside reusable-dispatch.yml. This is architecturally correct for per-repo mode (ADR 62), and the PR body asserts the per-org reusable-fix.yml is intentionally untouched per ADR 0044. Per-org installations that still call reusable-fix.yml retain the latent CRLF exposure.
    Remediation: Add a brief comment in the PR or follow-up issue noting that CRLF exposure in the deprecated per-org path is accepted under ADR 0044's deprecation timeline.

  • [naming-convention] internal/scaffold/workflow_call_alignment_test.go:355TestReusableDispatchFixInstructionNormalizesCRLF is the only exported test function in this file without a doc comment. Every other test function (24 total) is preceded by a // TestFoo validates that... comment.
    Remediation: Add a doc comment, e.g.: // TestReusableDispatchFixInstructionNormalizesCRLF validates that CRLF line endings in a comment body are stripped before the fix instruction is written to GITHUB_OUTPUT.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the review comment for full details.

Comment thread .github/workflows/reusable-dispatch.yml
Comment thread internal/scaffold/workflow_call_alignment_test.go
Add the missing test comment for the reusable dispatch fix-instruction
regression test.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Shai Revivo <srevivo@redhat.com>
@rh-hemartin
rh-hemartin added this pull request to the merge queue Sep 8, 2026
Merged via the queue into fullsend-ai:main with commit 3371a4e Sep 8, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strip CRLF from COMMENT_BODY in reusable-fix.yml (latent bug)

2 participants