Skip to content

fix: discover nested agent context plans#3061

Open
luohui1 wants to merge 1 commit into
github:mainfrom
luohui1:fix/3024-agent-context-nested-plan
Open

fix: discover nested agent context plans#3061
luohui1 wants to merge 1 commit into
github:mainfrom
luohui1:fix/3024-agent-context-nested-plan

Conversation

@luohui1

@luohui1 luohui1 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #3024 by making the agent-context update scripts discover the newest plan.md anywhere under specs/, including nested/scoped feature directories such as specs/scope/feature/plan.md.

Bash and PowerShell script behavior stays in parity, and the extension command documentation now describes recursive plan discovery.

Split out from #3053 after maintainer feedback to keep each bug fix in its own PR.

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv sync && uv run pytest
  • Tested with a sample project (if applicable)

Additional validation run locally:

  • uv run --extra test pytest tests/extensions/test_extension_agent_context.py -q - 35 passed, 1 skipped
  • uvx ruff check tests/extensions/test_extension_agent_context.py - passed
  • git diff --check - passed

Manual test results

Agent: Codex (GPT-5) | OS/Shell: Windows 11 / PowerShell 7.5.4

Command tested Notes
.specify/extensions/agent-context/scripts/powershell/update-agent-context.ps1 Covered by regression test with nested specs/scope/feature/plan.md.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

This PR was implemented by Codex (GPT-5) acting as an AI coding agent on behalf of @luohui1. The agent read the repository contribution/security/code-of-conduct docs and issue templates, inspected the relevant code paths, implemented the changes, ran the validation listed above, and prepared this PR description.

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

This PR fixes the bundled agent-context extension’s plan auto-discovery so it finds the most recently modified plan.md anywhere under specs/, including nested/scoped feature directories (e.g. specs/scope/feature/plan.md). This aligns the behavior with SPECIFY_FEATURE_DIRECTORY layouts and keeps Bash/PowerShell behavior in parity.

Changes:

  • Update Bash plan discovery from specs/*/plan.md to recursive specs/**/plan.md.
  • Update PowerShell plan discovery to recurse under specs/ and select the newest plan.md.
  • Add regression tests for nested plan discovery and update extension command docs to describe the recursive behavior.
Show a summary per file
File Description
tests/extensions/test_extension_agent_context.py Adds regression tests to ensure both scripts resolve nested specs/.../plan.md paths.
extensions/agent-context/scripts/powershell/update-agent-context.ps1 Switches plan discovery to recursive search under specs/ and picks most recently modified match.
extensions/agent-context/scripts/bash/update-agent-context.sh Switches plan discovery to recursive **/plan.md glob and updates related comments.
extensions/agent-context/commands/speckit.agent-context.update.md Updates documentation to describe recursive plan discovery behavior.

Copilot's findings

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Comment on lines +125 to 127
# Pick the most recently modified plan.md anywhere under specs/.
# Use find + sort by modification time to avoid ls/head fragility with
# spaces in paths or SIGPIPE from pipefail.

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address Copilot feedback. If not applicable, please explain why

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 extension ignores scoped/nested spec directories (SPECIFY_FEATURE_DIRECTORY), so plan auto-discovery finds nothing

3 participants