Skip to content

Nested extension failures suggest irrelevant missing flags instead of preserving tracker recovery #505

Closed

Description

@unbraind

Problem

When an extension command internally invokes another pm command and that nested command fails with tracker_not_initialized, the outer error recovery can invent an unrelated missing option from the nested invocation.

Observed with pm CLI 2026.7.10 and pm-todos:

pm --pm-path /tmp/work/.agents/pm todos import input.jsonl --format jsonl --upsert --json

The importer internally runs pm --pm-path ... --json list-all --limit 10000. Because the supplied tracker path was not initialized, the nested command correctly returned tracker_not_initialized. The outer command_failed envelope then added:

{
  "missing": ["--limit"],
  "suggested_retry": "pm ... todos import ... --limit <value>"
}

--limit is not an importer flag and cannot fix the failure. The correct recovery is to initialize or correct --pm-path, already present in the nested error.

Expected agent UX

  • Preserve the nested typed error code/recovery (tracker_not_initialized) when wrapping extension command failures.
  • Do not infer top-level missing flags from a nested command’s normalized/provided fields.
  • If wrapping is unavoidable, omit missing/suggested_retry unless the missing option belongs to the user-invoked command contract.
  • Include the authoritative tracker root returned by pm init in the retry example.

Why this matters

Agents are likely to follow structured suggested_retry fields verbatim. The current output wastes tokens and sends them toward an invalid command instead of the actual context/storage fix.

Reproduction context

  • pm CLI: 2026.7.10
  • Node: 22.19.0
  • Extension command path: todos import
  • Nested command: list-all --limit 10000

Activity

  1. coderabbitai commented on Jul 10, 2026

    @coderabbitai
    🔗 Related PRs

    #136 - Add package install recovery and collision plans [closed]
    #142 - Guard pm tracker path targeting for agents [closed]
    #418 - Refactor residual CodeFactor complexity hotspots [merged]
    #428 - Harden SDK extension runtime packaging [merged]
    #475 - Improve package install and annotation agent UX [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. unbraind commented on Jul 10, 2026

    @unbraind
    OwnerAuthor

    Additional reproduction of the same recovery-composition bug: an audit_update_restricted_options error correctly said --replace-tests/--test were forbidden with --allow-audit-update, but the outer recovery added missing: ["--unset"] and suggested appending --unset <value>. That retry is unrelated and would not remove the restricted options. This reinforces that inferred missing flags should be suppressed whenever a typed inner error already provides authoritative next steps.

  3. unbraind commented on Jul 11, 2026

    @unbraind
    OwnerAuthor

    Fixed by #511 and merged to main in f1dafef. The implementation passed 5,533 tests at exact 100/100/100/100 coverage plus all required CI, security, static, smoke, and bot-review gates.

  4. unbraind commented on Jul 11, 2026

    @unbraind
    OwnerAuthor

    pm tracker item:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions