the cagent-output fence may not always be at the start of the response#38
Merged
derekmisler merged 1 commit intodocker:mainfrom Feb 13, 2026
Conversation
Contributor
Author
|
/describe |
|
✅ PR description has been generated and updated! |
There was a problem hiding this comment.
Review Summary
Found 2 issues in the changed code that should be addressed:
- JavaScript regex inconsistency - The regex in pr-describe.yml doesn't handle mid-line code fences like the AWK script does
- Missing error handling - File read operation lacks try-catch wrapper
Both issues are in .github/workflows/pr-describe.yml and relate to the fallback extraction logic.
5215bf1 to
fbc8ae5
Compare
Contributor
Author
|
/review |
There was a problem hiding this comment.
Review Summary
Found 2 potential issues with the regex pattern in the JavaScript extraction code. The AWK script changes look solid.
Issues Found
- Medium severity: Regex requires newline before closing fence
- Low severity: Regex captures unwanted content when no newline after opening fence
Both issues could cause extraction failures in edge cases.
fbc8ae5 to
066e3a5
Compare
066e3a5 to
8746079
Compare
rumpl
approved these changes
Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug in the cagent-output extraction logic where code fences that don't start at the beginning of a line were not being properly detected. This occurs when AI agents emit conversational text before the code fence, causing the extraction to fail and potentially leak agent thoughts into the final output.
Changes
Modified
.github/workflows/pr-describe.yml: Updated JavaScript extraction logic to use regex matching instead of relying on line-based parsing for cagent-output blocksaction.yml: Modified AWK script to remove line-start anchoring (^) from the cagent-output pattern matching, allowing detection of code fences that appear mid-linetests/test-output-extraction.sh: Added comprehensive test case (1b) to verify extraction works when code fence is preceded by agent thoughts on the same lineTechnical Details
The core issue was that the extraction logic used
^```cagent-outputpattern matching, which only worked when the code fence started at the beginning of a line. However, AI agents sometimes emit conversational text like "I'll analyze the PR..." immediately before the code fence without a newline, causing the pattern to fail.Key changes:
raw.match(/```cagent-output\n([\s\S]*?)```/)) as a fallback to handle cases where the composite action's cleaning doesn't catch everything/```cagent-output/instead of/^```cagent-output$/and implemented proper state-based capturing that works regardless of line positionTesting
Breaking Changes
None - this is a backward-compatible bug fix that improves robustness.
Related Issues
None explicitly referenced - this addresses a reliability issue discovered during PR description generation workflows.
Checklist