fix(agent-context): discover nested plans in Python port mtime fallback#3734
Open
matecardoso wants to merge 1 commit into
Open
fix(agent-context): discover nested plans in Python port mtime fallback#3734matecardoso wants to merge 1 commit into
matecardoso wants to merge 1 commit into
Conversation
The Python port of update-agent-context reintroduced a one-level plan scan (specs/*/plan.md) in its mtime fallback, while the Bash and PowerShell ports search recursively (specs/**/plan.md) per the fix for issue github#3024. The three ports were therefore not in parity: for nested scoped layouts such as specs/<scope>/<feature>/plan.md, the Python port found no plan and omitted the plan link from the managed context section. Switch the fallback to `(root / "specs").rglob("plan.md")` and update the module docstring to match the documented recursive-discovery contract. Add a parity regression test covering the nested layout (it fails on the one-level glob and passes with the recursive scan). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns the Python agent-context updater with Bash and PowerShell recursive plan discovery.
Changes:
- Uses
rglob("plan.md")for nested plans. - Updates documentation and adds a parity regression test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
extensions/agent-context/scripts/python/update_agent_context.py |
Recursively discovers plans and documents the behavior. |
tests/extensions/test_update_agent_context_python_parity.py |
Verifies nested-plan parity with Bash. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
Closes #3733.
The
agent-contextPython port reintroduced a one-level plan scan (specs/*/plan.md) in its mtime fallback, while the Bash (specs.rglob("plan.md")) and PowerShell (-Recurse) ports search recursively per the fix for #3024. The three ports were therefore out of parity: for nested scoped layouts such asspecs/<scope>/<feature>/plan.md, the Python port found no plan and omitted the plan link from the managed context section.This changes the fallback to
(root / "specs").rglob("plan.md")and updates the module docstring to match the documented recursive-discovery contract.Testing
pytest tests/extensions/— 213 passed, 63 skipped (PowerShell parity skipped: nopwshlocally).test_python_mtime_fallback_finds_nested_plan_matching_bashto the parity suite. Verified it fails on the old one-level glob (Bash finds the nested plan, Python omits it → context files diverge) and passes with the recursive scan.AI Disclosure
The one-line fix, the docstring update, and the regression test were written by Claude (Anthropic) under my direction, and I reviewed them. The bug was discovered while enabling this extension in a downstream project; an automated code review flagged the port divergence, which I then traced to the #3024 fix not being carried into the later Python port (#3387).