Skip to content

feat: widen agentic_update scope guard allowlist to include prompt includes (#987)#991

Open
prompt-driven-github[bot] wants to merge 1 commit into
mainfrom
change/issue-987
Open

feat: widen agentic_update scope guard allowlist to include prompt includes (#987)#991
prompt-driven-github[bot] wants to merge 1 commit into
mainfrom
change/issue-987

Conversation

@prompt-driven-github
Copy link
Copy Markdown
Contributor

Summary

Updates the Scope Guard requirement in prompts/agentic_update_python.prompt so the runtime allowlist used by _revert_out_of_scope_changes aligns with the permissions documented in agentic_update_LLM.prompt. The agent's edits to <include>-referenced docs and to new shared include files under context/ are now preserved, while unrelated file mutations are still reverted.

Closes #987

Changes Made

Prompts Modified

  • pdd/prompts/agentic_update_python.prompt — Rewrites requirement Self‑upgrade to pdd‑cli 0.0.40 fails on Windows 11 (“No module named pip” inside uv shim) #10 (Scope Guard) to:
    • Parse <include> paths from the original prompt text (raw and ${VAR}-expanded) via compute_user_intent_paths from pdd/preprocess.py, reusing canonical PDD preprocessing/fingerprinting semantics (acceptance criterion 5).
    • Add a directory-prefix allowance for files under PROJECT_ROOT / "context".
    • Enforce PROJECT_ROOT containment on every entry added beyond the baseline.
    • Fall back to the legacy {prompt, code, tests} baseline on parser/IO failure (emits a non-fatal warning when verbose).
  • Adds pdd.preprocess (function compute_user_intent_paths) to the % Dependencies block of the prompt.

Why

pdd/agentic_update.py previously built _allowed = {prompt_path.resolve(), code_path.resolve()} | {p.resolve() for p in selected_tests}, so any included doc or new shared context/ include the agent intentionally edited could be reverted — breaking the "included docs are part of the prompt" contract tracked in #860 and #732.

Review Checklist

  • Prompt syntax is valid (closing tags, dependency block well-formed)
  • PDD conventions followed — new <pdd.preprocess> block uses <include select=\"def:compute_user_intent_paths\"> form
  • Fallback semantics preserve backward compatibility (legacy allowlist is a subset)
  • Acceptance criteria addressed:
    • Regression test: prompt includes a source doc; pdd update preserves agent's edit to that doc
    • Regression test: new shared include under context/ is preserved when intentionally created
    • Regression test: unrelated file mutations remain reverted
    • Implementation allowlist matches agentic_update_LLM.prompt permissions
    • Reuses include parsing from compute_user_intent_paths

Next Steps After Merge

  1. Regenerate code from modified prompts in dependency order:
    ./sync_order.sh
    Or manually:
    pdd sync agentic_update
    pdd sync git_update
    pdd sync sync_main
    pdd sync maintenance
    pdd sync update_main
    pdd sync modify
    pdd sync pin_example_hack
    pdd sync sync_orchestration
    
  2. Run tests to verify functionality, including the new regression tests for included-doc and context/-include preservation.
  3. Deploy if applicable.

Created by pdd change workflow

…cludes (#987)

Updates requirement #10 (Scope Guard) of `agentic_update_python.prompt` to
align the runtime allowlist with the permissions documented in
`agentic_update_LLM.prompt`. The allowlist now also covers documents
referenced by `<include>` tags in the prompt being updated and new shared
include files under the `context/` directory tree, while unrelated file
mutations remain reverted.

Adds `compute_user_intent_paths` from `pdd/preprocess.py` as a new
dependency so include parsing reuses the canonical PDD preprocessing/
fingerprinting semantics (acceptance criterion 5). Falls back to the
legacy baseline on parser/IO failure.

Closes #987

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

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: agentic update scope guard reverts included-doc edits

1 participant