Repository navigation
Add shared PageIndex indexing and tree-guided documentation search - #75939
Conversation
Co-authored-by: pelikhan <[email protected]>
| catalog = [] | ||
| for path in sorted(sources): | ||
| source = path.relative_to(root).as_posix() | ||
| content = path.read_text(encoding="utf-8") |
|
✅ PR Specification Reviewer completed successfully!
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
Reviewed head 6f8d9db213d98b0af148f0b3917f4b48d2aadd6f against Security Architecture Specification v1.1.9.
Blocking finding: .github/workflows/shared/pageindex.md indexes repository Markdown/MDX and writes its raw text into trees that the agent is instructed to read. Under IS-01, content from untrusted sources must be sanitized before delivery to the agent; the new path bypasses the sanitization pipeline and allows prompt-injection instructions in docs/READMEs to influence an agent with safe outputs. The existing inline comment on line 73 records this finding. Remediate by sanitizing or isolating indexed content before agent consumption, with conformance coverage.
The shared import also adds the python network ecosystem (NI-02/NI-04); justify this broadened egress and pin/attest the package supply chain before merge. No specification synchronization is appropriate for a security regression.
Generated by PR Specification Reviewer for #75939 · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review-specs to run again
There was a problem hiding this comment.
What this change does:
This adds a shared workflow import that installs PageIndex, builds local Markdown/MDX section trees, and teaches two agents to use them. It also adds regression tests for the embedded indexer.
Should fix:
-
The regression suite is dead code (
scripts/test_pageindex_workflow.py:L1)- What this is: This adds 143 lines of regression tests for the embedded indexer.
- Problem:
make test-scriptslists individual Python tests and does not include this file, sotest-allnever runs these cases; PageIndex is also not a repository Python dependency. - Fix: Wire the test into
test-scriptswith the pinned PageIndex environment, or remove this standalone suite. - If we skip it: The new indexer can regress without CI signal while these lines add maintenance cost.
-
The document hash is unused (
.github/workflows/shared/pageindex.md:L92)- What this is: Every indexed document gets a SHA-256 value in its tree JSON.
- Problem: No workflow instruction or consumer reads this
sha256field; it is only asserted by the new test. - Fix: Remove this field and its test assertion unless a consumer will validate it.
- If we skip it: Every run carries dead metadata and an extra full-content hash through the index.
Verdict: fix 1 and 2 first.
Not checked: generated lock files and correctness, security, and performance issues, per the requested scope; tests were inspected but not run.
Lean: -2 lines possible.
Generated by ✂️ Ponytail Reviewer for #75939 · codex · routed: gpt56 max · ~6 AIC · ⌖ ~1 AIC · ⊞ 118
Comment /ponytail to run again
| @@ -0,0 +1,143 @@ | |||
| """Regression checks for the shared local PageIndex workflow.""" | |||
There was a problem hiding this comment.
Test suite is not wired — What this is: This adds 143 lines of regression tests for the embedded indexer. Problem: make test-scripts lists individual Python tests and does not include this file, so test-all never runs these cases; PageIndex is also not a repository Python dependency. Fix: Wire the test into test-scripts with the pinned PageIndex environment, or remove this standalone suite. If we skip it: The new indexer can regress without CI signal while these lines add maintenance cost.
There was a problem hiding this comment.
Added the PageIndex suite to make test-scripts through a temporary Python 3.12 environment that installs pageindex==0.5.3. Commit af5b6520.
| tree_path = output / f"{key}.json" | ||
| tree_path.write_text(json.dumps({ | ||
| "source": source, | ||
| "sha256": hashlib.sha256(content.encode()).hexdigest(), |
There was a problem hiding this comment.
Dead per-document hash — What this is: Every indexed document gets a SHA-256 value in its tree JSON. Problem: The consumers use revision.txt, source, and structure, but no workflow reads this sha256 field; it is only asserted by the new test. Fix: Remove this field and its test assertion unless a consumer will validate it. If we skip it: Every run carries dead metadata and an extra full-content hash through the index.
There was a problem hiding this comment.
Removed the unused per-document sha256 field and its test assertion; source-path hashing remains for stable tree filenames. Commit af5b6520.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd and /diagnosing-bugs to the new PageIndex indexer and its test. Requesting changes because the regression test is not wired into any make target and fails without the pinned package.
📋 Key Themes & Highlights
Key Themes
- Test is not run anywhere:
scripts/test_pageindex_workflow.pyis missing fromtest-scriptsandtest-unit, so CI never executes it. - Test depends on an uninstalled package: at HEAD the suite ends with
FAILED (errors=11), allModuleNotFoundError: pageindex. It needs an explicit dependency or a clear skip. - Coverage gap on node IDs: the docs say node IDs are document-scoped and the agent reads by ID, but no test checks them.
- Least privilege: the bash allowlist
sed *permits in-place edits, which conflicts with the docs rule to use the Edit tool.
Positive Highlights
- ✅ The indexer rejects absolute paths and
.., skips symlinks, and checksis_relative_to(root). - ✅ The test blocks sockets and patches
subprocess, which keeps it hermetic. - ✅ Revision checks cover stale indexes.
Limits of this review
I could not install pageindex==0.5.3 in this sandbox, so I did not verify the indexer against the pinned library API. The existing GHAS comments on network: python and indexed-content prompt injection are still open and are not repeated here.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 5.4K
Comment /matt to run again
| tree = self.tree(entry)["structure"] | ||
| self.assertEqual(tree[0]["text"], "Introduction") | ||
| self.assertEqual(tree[1]["title"], "Guide") | ||
| self.assertEqual(tree[1]["line_num"], 2) |
There was a problem hiding this comment.
[/tdd] The PR says document-scoped node IDs are preserved, and the agent is told to read nodes by ID, yet no test asserts node_id. Add a check that every node in a document has a node_id and that IDs are unique within that document. Walk nested nodes recursively, because uniqueness is per document and not global.
@copilot please address this.
There was a problem hiding this comment.
Added recursive checks that every node in each document has a non-empty string node_id and that IDs are unique within that document. Commit af5b6520.
| @@ -0,0 +1,143 @@ | |||
| """Regression checks for the shared local PageIndex workflow.""" | |||
There was a problem hiding this comment.
[/tdd] No target runs this suite. scripts/test_pageindex_workflow.py is not listed in the test-scripts target (Makefile, around line 543), so the regression checks will not run. Add it beside the other Python script tests, with the pinned package available to the environment.
💡 Suggested Makefile entry
Add under test-scripts:
python3 scripts/test_pageindex_workflow.py@copilot please address this.
There was a problem hiding this comment.
Wired the regression suite into make test-scripts; its target installs pinned pageindex==0.5.3 in a temporary Python 3.12 environment. Commit af5b6520.
| tools: | ||
| bash: | ||
| - "jq *" | ||
| - "sed *" |
There was a problem hiding this comment.
Least privilege: sed * is broader than the agent needs. sed * allows in-place edits (sed -i) and w-file writes. That conflicts with the rule in daily-doc-updater.md to edit with the Edit tool, not sed. The instructions only read with sed -n, so narrow the allowlist to sed -n *. Note that sed -n can still run a w command, so use the most specific pattern your matcher supports.
💡 Suggested change
tools:
bash:
- "jq *"
- "sed -n *"
- "git rev-parse HEAD"Run make recompile afterward so both lock files pick this up.
@copilot please address this.
There was a problem hiding this comment.
Narrowed the shared workflow's sed allowance to sed -n * and recompiled the consumers. Commit af5b6520.
| }), patch("subprocess.check_output", return_value="fixture-revision\n"), \ | ||
| patch("socket.socket.connect", side_effect=AssertionError("Network forbidden")): | ||
| with contextlib.redirect_stdout(io.StringIO()): | ||
| exec(compile(script, str(SOURCE), "exec"), {}) |
There was a problem hiding this comment.
[/tdd] The suite cannot pass in a clean checkout. exec runs the embedded script, which imports pageindex, and nothing installs it for the test. At HEAD, python3 scripts/test_pageindex_workflow.py ends with FAILED (errors=11) and ModuleNotFoundError: pageindex. Declare the dependency explicitly, and skip with a clear reason when it is missing so failures are not confusing.
💡 Suggested guard
import importlib.util
@unittest.skipUnless(
importlib.util.find_spec("pageindex"),
"requires pageindex==0.5.3 (see shared/pageindex.md)",
)
class PageIndexWorkflowTests(unittest.TestCase):A silent skip hides the regression, so pair this with an environment that installs the pinned version (see the Makefile comment).
@copilot please address this.
There was a problem hiding this comment.
The suite now skips with an explicit reason when run directly without PageIndex; make test-scripts installs pageindex==0.5.3 first, and fails clearly if uv is unavailable. Commit af5b6520.
There was a problem hiding this comment.
🟡 Changes recommended
Missing uv setup and unquoted wildcard inputs can block the workflows, while unnecessary network access and unverified transitive dependencies introduce critical security risks.
5 open issues
What changed in this PR
Adds reusable local PageIndex support to gh-aw workflows, letting existing agents navigate documentation through section trees without cloud indexing or separate model credentials.
Changes:
- Build configurable Markdown/MDX catalogs with source paths, line numbers, and document-scoped node IDs.
- Integrate tree-guided retrieval into the documentation updater and specification librarian, preserving source verification and exhaustive checks.
- Add regression checks and regenerate both consumer workflow locks.
| File | Description |
|---|---|
scripts/test_pageindex_workflow.py |
Adds indexing and consumer-integration regression checks. |
.github/workflows/spec-librarian.md |
Imports PageIndex with a package-specification-only corpus. |
.github/workflows/spec-librarian.lock.yml |
Compiles indexing setup and retrieval guidance for the librarian. |
.github/workflows/shared/pageindex.md |
Defines configurable local indexing, retrieval guidance, and source safeguards. |
.github/workflows/daily-doc-updater.md |
Uses PageIndex to discover documentation affected by recent changes. |
.github/workflows/daily-doc-updater.lock.yml |
Compiles indexing setup and retrieval guidance for the updater. |
Review effort: Max (auto)
| - "git rev-parse HEAD" | ||
|
|
||
| steps: | ||
| - name: Install local PageIndex |
| run: | | ||
| set -euo pipefail | ||
| uv venv --python 3.12 --python-preference only-managed /tmp/gh-aw/pageindex/venv | ||
| uv pip install --python /tmp/gh-aw/pageindex/venv/bin/python "pageindex==0.5.3" |
|
|
||
| - name: Index Markdown with PageIndex | ||
| env: | ||
| PAGEINDEX_PATTERNS: ${{ github.aw.import-inputs.patterns }} |
| headings, lines = extract_nodes_from_markdown(content) | ||
| headings = [ | ||
| node for node in headings | ||
| if re.match(r"^#{1,6}\s+", lines[node["line_num"] - 1].strip()) | ||
| ] |
Co-authored-by: pelikhan <[email protected]>
Implemented in 0212baf: indexing now runs in a separate job with a credential-free depth-1 checkout, and the agent restores its exact-key actions/cache index. Added pinned uv setup and a three-day package cooldown; removed Python egress from the shared import. Both consumer locks regenerated, all 11 regressions and the final validation gate passed. CodeQL timed out. |
| uv venv --python 3.12 /tmp/gh-aw/pageindex/venv | ||
| uv pip install --exclude-newer "$(date -u -d '3 days ago' +%Y-%m-%dT%H:%M:%SZ)" --only-binary=:all: --python /tmp/gh-aw/pageindex/venv/bin/python "pageindex==0.5.3" |
| catalog = [] | ||
| for path in sorted(sources): | ||
| source = path.relative_to(root).as_posix() | ||
| content = path.read_text(encoding="utf-8") |
| tools: | ||
| bash: | ||
| - "jq *" | ||
| - "sed *" |
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 0212baf
|
Sous-chef requested-head: 0212baf |
…entic-workflow # Conflicts: # .github/workflows/daily-doc-updater.lock.yml # .github/workflows/spec-librarian.lock.yml Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
| `jq '.[].source' /tmp/gh-aw/pageindex/index/catalog.json`. | ||
| 2. Read the outlines for a small set of relevant documents, then reason about | ||
| which sections answer the question. Do not load the entire corpus into context. | ||
| 3. Read only the selected node IDs from the corresponding tree with `jq`; |
|
🎉 This pull request is included in a new release. Release: |


Add reusable PageIndex indexing and search support, and apply it to workflows that navigate documentation and package specifications.