Skip to content

fix(autodoc): trailing newline + random delimiter in eval context output - #37022

Open
jdcmsd wants to merge 1 commit into
mainfrom
fix/autodoc-eval-context-newline
Open

fix(autodoc): trailing newline + random delimiter in eval context output#37022
jdcmsd wants to merge 1 commit into
mainfrom
fix/autodoc-eval-context-newline

Conversation

@jdcmsd

@jdcmsd jdcmsd commented Aug 11, 2026

Copy link
Copy Markdown
Member

What broke and why

The first real trigger of the prep → claude → finalize pipeline (#36495) failed in Build evaluation context with:

##[error]Invalid value. Matching delimiter not found '__AUTODOC_EOF__'

Root cause: the Python script wrote /tmp/eval_context.md via '\n'.join(lines) with no trailing newline. The file's last character was . (end of "Use the Write tool to write the report to exactly that path."). When cat piped that into GITHUB_OUTPUT, echo '__AUTODOC_EOF__' appended directly to the last line of content rather than starting a new one. The runner looked for __AUTODOC_EOF__ as a standalone line and never found it.

This code path was introduced in the OIDC restructure and had never successfully run against a real issue before this trigger.

Fixes

  1. Trailing newline: '\n'.join(lines) + '\n' — ensures the delimiter always lands on its own line.
  2. Random delimiter: openssl rand -hex 16 — defense-in-depth so no future issue or PR body can accidentally inject the closing token. This is the GitHub-recommended pattern for multiline outputs.

Fixes #36949

🤖 Generated with Claude Code

… delimiter

The eval context file was written without a trailing newline, causing the
closing GITHUB_OUTPUT delimiter to be appended to the last line of content
rather than its own line. The runner never found the standalone delimiter
and failed with "Matching delimiter not found".

Also switch from a fixed __AUTODOC_EOF__ delimiter to openssl rand-generated
hex so no future issue or PR body can accidentally inject the closing token.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Claude finished @jdcmsd's task in 32s —— View job


Code Review

  • Gather context (read diff + surrounding workflow code)
  • Analyze the fix
  • Post review

Reviewed .github/workflows/issue_autodoc.yml (git diff origin/main...HEAD).

Both changes are correct and directly address the root cause described in #36949.

1. Trailing newline (issue_autodoc.yml:307)'\n'.join(lines) + '\n' guarantees the file ends on a newline, so echo "${DELIM}" lands on its own line rather than being appended to the last content line. This is exactly the failure the runner hit (Matching delimiter not found). ✅

2. Random delimiter (issue_autodoc.yml:311-315)openssl rand -hex 16 produces a 32-char hex token that cannot realistically appear in issue/PR body content, eliminating the delimiter-injection class of bug entirely. This matches GitHub's documented pattern for multiline outputs. ✅

Minor notes (non-blocking):

  • openssl is present on GitHub-hosted ubuntu runners by default, so the new dependency is safe. If this job could ever run on a minimal self-hosted runner, that assumption would need re-checking — but nothing in the diff suggests that.
  • With the two fixes combined, even if content ever contained the delimiter, the << heredoc would still be well-formed because the token is randomized per run.

New Issues

No issues found.

The fix is minimal, correct, and follows the recommended GitHub Actions convention. LGTM.
· fix/autodoc-eval-context-newline

@github-actions github-actions Bot added the Area : CI/CD PR changes GitHub Actions/workflows label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : CI/CD PR changes GitHub Actions/workflows

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

ci(autodoc): fix Bedrock OIDC and harden autodoc workflow

1 participant