Skip to content

[enhancement](CI) Force inject required AGENTS guides into review prompt#64536

Merged
zclllyybb merged 2 commits into
apache:masterfrom
zclllyybb:dynamic_prompt
Jun 15, 2026
Merged

[enhancement](CI) Force inject required AGENTS guides into review prompt#64536
zclllyybb merged 2 commits into
apache:masterfrom
zclllyybb:dynamic_prompt

Conversation

@zclllyybb

Copy link
Copy Markdown
Contributor

Problem Summary: Automated code review runs relied on the reviewer to infer which module-specific AGENTS.md files apply to a pull request. Recent Litefuse traces showed that reviews often skipped ancestor guides such as the repository root AGENTS.md, fe/AGENTS.md, and be/test/AGENTS.md even when the changed files made them applicable. This change fetches the PR changed file list, derives every existing AGENTS.md file from the changed file ancestor directories, records the list in the review context, and injects the required guide paths directly into the first Codex review prompt.

We tested 5 PRs that did not read the AGENTS.md file during previous pipeline runs, and the new results are as follows:

Origin PR Test PR Run Litefuse Trace Result
#64478 zclllyybb#36 27536249602 d76b77ac4e0d52d96f413b154c9f2571 Read All
#64458 zclllyybb#37 27536258049 8db34388a8379acdcd9e48720f11225f Read All
#64392 zclllyybb#38 27536266784 a5e37fba03375a9517f7a67e33f70d39 Read All
#64489 zclllyybb#39 27536275680 22ace18d70ece96b0ca7fa73123b62da Read All
#64419 zclllyybb#41 27538239601 1803c040e4140d61e840e4e1526190e7 Read All

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Automated code review runs relied on the reviewer to infer which module-specific AGENTS.md files apply to a pull request. Recent Litefuse traces showed that reviews often skipped ancestor guides such as the repository root AGENTS.md, fe/AGENTS.md, and be/test/AGENTS.md even when the changed files made them applicable. This change fetches the PR changed file list, derives every existing AGENTS.md file from the changed file ancestor directories, records the list in the review context, and injects the required guide paths directly into the first Codex review prompt.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - Ran python3 -m py_compile .github/scripts/prepare_review_agents.py
    - Parsed .github/workflows/code-review-runner.yml and .github/workflows/code-review-comment.yml with Python yaml.safe_load
    - Ran the helper against apache#64496 changed files and verified it produced AGENTS.md, be/src/common/AGENTS.md, be/src/io/AGENTS.md, and be/test/AGENTS.md
- Behavior changed: Yes, automated review prompts now explicitly require the AGENTS.md guides matching the PR changed file ancestors
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: The review runner checks out the pull request head before preparing the prompt, so helper scripts added on the workflow branch may be absent when reviewing older pull requests. This change downloads the AGENTS prompt helper from the workflow ref, matching the existing Litefuse helper pattern, and adds workflow_dispatch inputs so the runner can be validated directly from a branch before it reaches the default branch.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - Ran python3 -m py_compile .github/scripts/prepare_review_agents.py
    - Parsed .github/workflows/code-review-runner.yml and .github/workflows/code-review-comment.yml with Python yaml.safe_load
- Behavior changed: Yes, the reusable review runner can now also be started manually through workflow_dispatch for validation
- Does this need documentation: No
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@zclllyybb

Copy link
Copy Markdown
Contributor Author

run buildall

@zclllyybb

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jun 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@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.

Review result: no blocking issues found.

Checkpoint conclusions:

  • Goal/test: the change injects required AGENTS.md guide paths into the automated review prompt. The helper compiles, the workflow YAML parses, and the helper produced the expected AGENTS.md list for both a representative sample and this PR's actual changed files.
  • Scope/focus: the PR is small and focused on review-runner prompt preparation.
  • Concurrency/lifecycle/config/compatibility/storage/transaction/data-write concerns: not applicable; this only changes CI prompt plumbing and a local helper script.
  • Parallel paths: workflow_call and workflow_dispatch share the same input contract, and the helper download follows the existing workflow-ref pattern already used for Litefuse recording.
  • Error handling/observability: API/helper failures fail the workflow visibly; generated changed-file and AGENTS context files are included in the prompt context.
  • Test coverage/results: no Doris kernel/regression tests are needed for this CI-only change. I verified python3 -m py_compile .github/scripts/prepare_review_agents.py, parsed the runner/comment workflows with yaml.safe_load, and exercised the helper output.
  • User focus: no additional user-provided review focus was supplied.

@zclllyybb
zclllyybb merged commit 0f1c6d2 into apache:master Jun 15, 2026
33 checks passed
@zclllyybb
zclllyybb deleted the dynamic_prompt branch June 15, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants