Skip to content

Conversation

@DevelopmentCats
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 18, 2025 21:15
@github-actions
Copy link

github-actions bot commented Dec 18, 2025

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the documentation check workflow to run on all pull requests, adding intelligent differentiation between new PRs and PR updates. The workflow now installs the Coder CLI, creates AI-powered tasks to analyze documentation needs, and streams real-time task output to GitHub Actions.

Key changes:

  • Added Coder CLI installation and authentication steps for task execution
  • Implemented trigger type detection to provide different analysis prompts for new PRs versus PR updates
  • Added real-time task output streaming and automatic workspace cleanup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +406 to +407
if: always()
env:
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The command coder ssh "${TASK_NAME}" -- timeout 600 curl -sN http://localhost:3284/events could fail silently due to the || true at the end of the while loop. While this prevents workflow failure, it means connection issues, authentication problems, or other SSH failures won't be visible. Consider logging the exit status or adding more specific error handling before falling back to || true.

Suggested change
if: always()
env:
done
STREAM_EXIT_STATUS=${PIPESTATUS[0]}
if [[ "${STREAM_EXIT_STATUS}" -ne 0 ]]; then
echo "Warning: coder ssh stream exited with status ${STREAM_EXIT_STATUS}" >&2
fi

Copilot uses AI. Check for mistakes.
Comment on lines 388 to 394
echo "---"
fi
# Check for status change to stable (task complete)
STATUS=$(echo "$DATA" | jq -r '.status // empty' 2>/dev/null)
if [[ "$STATUS" == "stable" ]]; then
echo ""
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The jq parsing on line 389 uses jq -r '.message // empty' with error redirection to /dev/null. If the JSON parsing fails (malformed JSON), the error is silently ignored, potentially causing missed output. Consider checking if jq parsing succeeds or logging parse failures to help debug issues with the event stream format.

Copilot uses AI. Check for mistakes.
exit 1
fi
sleep 5
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The status check logic only handles "failed" and "canceled" workspace states, but there might be other error states that should cause the workflow to exit (e.g., "stopped", "deleting", "error"). Consider checking for any non-success states more comprehensively, or document why only these two states are checked.

Suggested change
sleep 5
if [[ "$WORKSPACE_STATUS" == "failed" || "$WORKSPACE_STATUS" == "canceled" || "$WORKSPACE_STATUS" == "stopped" || "$WORKSPACE_STATUS" == "deleting" || "$WORKSPACE_STATUS" == "error" ]]; then

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +145
SETUPEOF
)
# Full analysis comment format (for new PRs)
COMMENT_FORMAT=$(cat <<'COMMENTEOF'
FULL ANALYSIS COMMENT FORMAT (for new PRs):
<!-- doc-check-analysis -->
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The SETUP_INSTRUCTIONS heredoc uses an unquoted delimiter (SETUPEOF) which allows PR_NUMBER to expand. While this appears intentional, if PR_NUMBER contains any shell metacharacters, it could lead to unexpected behavior when this instruction is included in the task prompt. Consider validating PR_NUMBER is numeric before using it in the heredoc, or using a safer substitution method.

Copilot uses AI. Check for mistakes.
steps:
- name: Install Coder CLI
run: |
curl -fsSL "${{ secrets.DOC_CHECK_CODER_URL }}/install.sh" | sh
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The Coder CLI installation script is executed from a URL stored in secrets without verifying its integrity (e.g., checksum verification). This could be a security risk if the secret is compromised or if there's a man-in-the-middle attack. Consider adding checksum verification or using a pinned version from a trusted source.

Suggested change
curl -fsSL "${{ secrets.DOC_CHECK_CODER_URL }}/install.sh" | sh
curl -fsSL "${{ secrets.DOC_CHECK_CODER_URL }}/install.sh" -o coder-install.sh
echo "${{ secrets.DOC_CHECK_CODER_INSTALL_SHA256 }} coder-install.sh" | sha256sum -c -
sh coder-install.sh

Copilot uses AI. Check for mistakes.
Comment on lines 380 to 382
if [[ "$line" == data:* ]]; then
DATA="${line#data:}"
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The timeout value of 600 seconds (10 minutes) for the curl command is hardcoded. This should be consistent with or related to other timeout values in the workflow, or extracted as a configurable parameter. Additionally, consider whether 10 minutes is sufficient for complex PR analyses.

Suggested change
if [[ "$line" == data:* ]]; then
DATA="${line#data:}"
# Configure stream timeout (seconds), defaulting to 600 if not set
STREAM_TIMEOUT_SECONDS="${STREAM_TIMEOUT_SECONDS:-600}"
# Stream events from AgentAPI via SSH
# This shows real-time AI conversation output
coder ssh "${TASK_NAME}" -- timeout "${STREAM_TIMEOUT_SECONDS}" curl -sN http://localhost:3284/events 2>/dev/null | \

Copilot uses AI. Check for mistakes.
else
echo "No task name found, skipping cleanup"
fi
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The task deletion command uses 2>&1 || echo "Task deletion failed or already deleted", which masks the actual error that occurred. If the deletion fails for reasons other than "already deleted" (e.g., permissions issues, network problems), this could hide important debugging information. Consider capturing and logging the actual error message, or at least distinguishing between different failure modes.

Suggested change
if ! coder exp task delete -y "${TASK_NAME}" 2>&1; then
status=$?
echo "Task deletion command failed with exit code ${status}." >&2
echo "The task may already be deleted, or there may be another issue (e.g., permissions or network problems)." >&2
exit "${status}"
fi

Copilot uses AI. Check for mistakes.
# Parse SSE events
if [[ "$line" == data:* ]]; then
DATA="${line#data:}"
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The hardcoded localhost URL http://localhost:3284/events assumes a specific port and endpoint for the AgentAPI. If this configuration changes or varies between environments, the streaming will fail silently due to the || true. Consider making the port and endpoint configurable, or at least document why this specific endpoint is used.

Suggested change
AGENTAPI_EVENTS_URL="${AGENTAPI_EVENTS_URL:-http://localhost:3284/events}"
coder ssh "${TASK_NAME}" -- timeout 600 curl -sN "${AGENTAPI_EVENTS_URL}" 2>/dev/null | \

Copilot uses AI. Check for mistakes.
Comment on lines 105 to 215
Review PR #${PR_NUMBER} and determine if documentation needs updating or creating.
This is a NEW PR - perform a complete analysis from scratch.
PR URL: ${PR_URL}
WORKFLOW:
1. Setup (repo is pre-cloned at ~/coder)
cd ~/coder
git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER}
git checkout pr-${PR_NUMBER}
${SETUP_INSTRUCTIONS}
2. Get PR info
WORKFLOW:
1. Get PR info
Use GitHub MCP tools to get PR title, body, and diff
Or use: git diff main...pr-${PR_NUMBER}
3. Understand Changes
Read the diff and identify what changed
2. Understand ALL Changes
Read the entire diff and identify what changed
Ask: Is this user-facing? Does it change behavior? Is it a new feature?
4. Search for Related Docs
3. Search for Related Docs
cat ~/coder/docs/manifest.json | jq '.routes[] | {title, path}' | head -50
grep -ri "relevant_term" ~/coder/docs/ --include="*.md"
5. Decide
4. Decide
NEEDS DOCS if: New feature, API change, CLI change, behavior change, user-visible
NO DOCS if: Internal refactor, test-only, already documented, non-user-facing, dependency updates
FIRST check: Did this PR already update docs? If yes and complete, say "No Changes Needed"
6. Comment on the PR using this format
5. Comment on the PR
- This is a new PR, so CREATE a new comment with the marker
- Use the format below
- Keep headings clean (no emojis in headings)
- Use status indicators sparingly (✓ ⚠ ✗)
COMMENT FORMAT:
## 📚 Documentation Check
${COMMENT_FORMAT}
### ✅ Updates Needed
- **[docs/path/file.md](github_link)** - Brief what needs changing
DOCS STRUCTURE:
Read ~/coder/docs/manifest.json for the complete documentation structure.
Common areas include: reference/, admin/, user-guides/, ai-coder/, install/, tutorials/
### 📝 New Docs Needed
- **docs/suggested/location.md** - What should be documented
EOF
)
### ✨ No Changes Needed
[Reason: Documents already updated in PR | Internal changes only | Test-only | No user-facing impact]
else
echo "Building PR UPDATE prompt (incremental analysis)"
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The heredoc uses an unquoted delimiter (EOF) which allows variable expansion. While this appears intentional for PR_NUMBER, it creates a risk of command injection if any of the environment variables (PR_URL, PR_NUMBER, TRIGGER_TYPE) contain malicious content. Since these come from GitHub context, they should be properly sanitized or the heredoc should use quoted delimiters with explicit variable substitution only for trusted values.

Copilot uses AI. Check for mistakes.
Comment on lines 221 to 283
PR #${PR_NUMBER} has been UPDATED with new commits (trigger: ${TRIGGER_TYPE}).
PR URL: ${PR_URL}
${SETUP_INSTRUCTIONS}
IMPORTANT CONTEXT:
- This PR was previously analyzed (there may be an earlier doc-check comment)
- New commits have been pushed since then
- Your job is to provide a BRIEF update, not repeat the full analysis
WORKFLOW:
1. Check recent commits
git log --oneline -5
See what was added/changed recently
2. Quick assessment
- Do the new changes affect documentation needs?
- Were docs added/updated in the new commits?
- Is this a significant change or minor fix?
3. Post a SHORT update comment
- DO NOT update or edit previous comments
- Create a NEW, BRIEF comment (see format below)
- Keep it conversational and minimal
- Only do a full re-analysis if changes are substantial
UPDATE COMMENT FORMAT (keep it SHORT!):
<!-- doc-check-update -->
### Doc Check Update
**Commits reviewed:** [X new commits]
[Pick ONE status line based on situation:]
✓ **No changes needed** - [brief reason: minor fix / internal change / etc.]
✓ **Docs updated** - [what was added/changed in docs]
⚠ **Still needs docs** - [brief reminder of what's outstanding]
⚠ **Updated but requesting changes** - [acknowledge changes but note what's still missing]
✗ **New issues found** - [if new commits introduce new doc requirements]
---
*This comment was generated by an AI Agent through [Coder Tasks](https://coder.com/docs/ai-coder/tasks)*
*[Coder Tasks](https://coder.com/docs/ai-coder/tasks)*
DOCS STRUCTURE:
Read ~/coder/docs/manifest.json for the complete documentation structure.
Common areas include: reference/, admin/, user-guides/, ai-coder/, install/, tutorials/
But check manifest.json - it has everything.
GUIDELINES:
- Be concise! 2-4 lines is ideal
- Don't repeat previous analysis
- Focus only on what CHANGED
- Use emojis sparingly (only ✓ ⚠ ✗ for status)
- No emojis in headings
- If nothing documentation-relevant changed, just say so briefly
- Only do full analysis if the PR direction changed significantly
EOF
)
fi
# Output the prompt
{
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The same security concern applies here - the unquoted heredoc delimiter allows variable expansion of all environment variables, which could lead to command injection if PR_URL, PR_NUMBER, or TRIGGER_TYPE contain malicious content. Consider using a quoted delimiter ('EOF') and explicitly substituting only the trusted variables.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Documentation Check

Analyzed: 2025-12-18 22:30 UTC

No Changes Needed

This PR modifies the internal CI workflow (.github/workflows/doc-check.yaml) that runs automated documentation checks on pull requests. The changes are:

  • Workflow now triggers on opened and synchronize events instead of requiring the doc-check label
  • Adds logic to detect new PRs vs updates and provide different analysis styles
  • Adds task output streaming to show AI analysis progress in GitHub Actions logs
  • Workflow logic changes only - no user-facing features affected

Reason: Internal CI/CD changes only. No user-facing features, APIs, CLI commands, or product behavior changes. This workflow is used by maintainers/contributors, not end users of Coder.


Analysis by Coder Tasks - Updates will appear as new comments

Copy link
Contributor Author

Documentation Check

Analyzed: 2025-12-18

No Changes Needed

This PR modifies the .github/workflows/doc-check.yaml CI workflow file to enhance the documentation checking process. The changes are internal to the GitHub Actions automation and do not affect:

  • User-facing features or behavior
  • API endpoints or CLI commands
  • Product documentation content
  • Installation or configuration steps

Reason: Internal CI workflow changes only - no user-facing documentation impact.


Analysis by Coder Tasks - Updates will appear as new comments

- Add explicit STEP markers with CHECKPOINT requirements
- Require showing command output as evidence
- Make commenting the FINAL step only after analysis
- Add warnings against skipping steps or making assumptions
- Require specific file/line references in decisions
Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (c1c987a - 4be7d7c)

No changes needed - All commits are CI workflow improvements (header formatting, workspace debugging, task naming). No feature or user-facing changes that require documentation.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (c1c987a - 4be7d7c)

No changes needed - All commits are CI infrastructure improvements to the doc-check workflow itself (better task names, checkpoint requirements, workflow fixes). No user-facing features or changes requiring documentation.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (c1c987a, 4be7d7c, 7e9cffa)

No changes needed - Recent commits only modify the CI workflow itself (.github/workflows/doc-check.yaml). No user-facing changes or documentation updates required.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (c1c987a, 4be7d7c, 7e9cffa)

No changes needed - Recent commits only modify CI workflow files (.github/workflows/doc-check.yaml), no user-facing changes.


Coder Tasks

Coder extracts display_name from first line of prompt.
Now shows 'Doc Check: PR #XXXX - Full Analysis' or 'Doc Check: PR #XXXX - Update'
instead of random Docker-style names like 'Agitated khayyam'
Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (006ac48, c1c987a, 4be7d7c)

No changes needed - Recent commits only modify .github/workflows/doc-check.yaml (the CI workflow itself). No product code, documentation, or user-facing features were changed - just workflow formatting and prompt improvements.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (006ac48, c1c987a, 4be7d7c)

No changes needed - Recent commits only modified .github/workflows/doc-check.yaml (CI workflow improvements: formatting, checkpoint requirements, and enhanced instructions). No product code or user-facing features changed.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (fd300cf - c1c987a)

No changes needed - Recent commits only refine the doc-check CI workflow itself (event stream handling, task display, header formatting). No feature code or documentation files were modified.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (d779f42 through 4be7d7c)

No changes needed - All recent commits are CI workflow improvements to .github/workflows/doc-check.yaml only. No code or documentation changes to the actual PR content.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (31e604d, d779f42, fd300cf)

No changes needed - CI workflow debugging only (SSE event parsing refinements in .github/workflows/doc-check.yaml)


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits

No changes needed - CI workflow refinements only (doc-check formatting/reporting improvements), no feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (38a3cfb, f1546aa, f7c760b)

No changes needed - Recent commits only modify CI workflow (.github/workflows/doc-check.yaml), no feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through d779f42)

No changes needed - Recent commits are CI workflow refinements (doc-check.yaml formatting and reporting improvements), not feature changes requiring documentation updates.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (38a3cfb, f1546aa, f7c760b)

No changes needed - CI workflow refinements only (doc-check.yaml formatting and reporting improvements). No feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through f1546aa)

No changes needed - All recent commits are CI workflow improvements to the doc-check system itself (formatting, reporting, SSE parsing). No documentation or feature changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (38a3cfb, f1546aa, f7c760b)

No changes needed - Recent commits only modify CI workflow (.github/workflows/doc-check.yaml), no feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through f1546aa)

No changes needed - CI workflow refinements only (doc-check reporting improvements), no feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through f1546aa)

No changes needed - All recent commits are CI workflow refinements for the doc-check system itself. No documentation or feature changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through d779f42)

No changes needed - Recent commits only modify the CI workflow (.github/workflows/doc-check.yaml). No documentation or feature changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through d779f42)

No changes needed - Recent commits are CI workflow improvements only (formatting, reporting, SSE parsing). No feature code or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through d779f42)

No changes needed - All recent commits are CI workflow improvements for the doc-check system itself. No feature changes or documentation updates required.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through f1546aa)

No changes needed - All recent commits are CI workflow refinements to the doc-check system itself (formatting, reporting, SSE parsing). No feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb - f7c760b)

No changes needed - All recent commits are CI workflow refinements for the doc-check system itself (formatting, reporting, SSE parsing). No feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits

No changes needed - Recent commits only modify CI workflow configuration (.github/workflows/doc-check.yaml). No documentation or feature changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits

No changes needed - All recent commits are CI workflow improvements (doc-check.yaml formatting and reporting enhancements). No feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through f1546aa)

No changes needed - Recent commits only modify CI workflow configuration (.github/workflows/doc-check.yaml), no feature or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through f1546aa)

No changes needed - Recent commits only modify the .github/workflows/doc-check.yaml CI workflow itself (formatting, reporting, SSE parsing improvements). No feature code or documentation files were changed.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (38a3cfb through f1546aa)

No changes needed - Recent commits only modify the CI workflow itself (.github/workflows/doc-check.yaml). No feature code or documentation files were changed.

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (38a3cfb, f1546aa, f7c760b)

No changes needed - Recent commits only modify CI workflow infrastructure (.github/workflows/doc-check.yaml). No feature code or documentation changes.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (3466cdb...f7c760b)

No changes needed - Recent commits are CI workflow improvements to the doc-check process itself (). No changes to PR content or documentation files.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (d652c3a - f1546aa)

No changes needed - All recent commits are CI workflow improvements to the doc-check process itself. No feature code or documentation was modified.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (d652c3a to 38a3cfb)

No changes needed - All recent commits are CI workflow improvements to the doc-check system itself. No feature code or documentation files were modified.


Coder Tasks

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 5 new commits (d652c3a to 3466cdb)

No changes needed - All commits are CI workflow improvements to the doc-check process itself. No feature code or documentation files were modified.


Coder Tasks

steps:
- name: Install Coder CLI
run: |
curl -fsSL "${{ secrets.DOC_CHECK_CODER_URL }}/install.sh" | sh
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Doc Check Update

Commits reviewed: 3 new commits (5cdcea0, d652c3a, 3466cdb)

No changes needed - Recent commits only modify CI workflow infrastructure (.github/workflows/doc-check.yaml). No feature or documentation changes.


Coder Tasks

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.

3 participants