Skip to content

fix(agent-context): discover nested plans in Python port mtime fallback#3734

Open
matecardoso wants to merge 1 commit into
github:mainfrom
matecardoso:fix/agent-context-python-recursive-plan
Open

fix(agent-context): discover nested plans in Python port mtime fallback#3734
matecardoso wants to merge 1 commit into
github:mainfrom
matecardoso:fix/agent-context-python-recursive-plan

Conversation

@matecardoso

Copy link
Copy Markdown

Description

Closes #3733.

The agent-context Python 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 as specs/<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

  • Ran existing tests with pytest tests/extensions/213 passed, 63 skipped (PowerShell parity skipped: no pwsh locally).
  • Added test_python_mtime_fallback_finds_nested_plan_matching_bash to 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.
  • Tested with a sample project (if applicable)

AI Disclosure

  • I did use AI assistance (describe below)

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

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>
@matecardoso
matecardoso requested a review from mnriem as a code owner July 25, 2026 00:44
Copilot AI review requested due to automatic review settings July 25, 2026 00:44

Copilot AI 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.

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.

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.

[Bug]: agent-context Python port misses nested plans (one-level glob), a parity regression of #3024

2 participants