Skip to content

Agent UX: pm test --run with --only-last (or any selector) still prints every linked test record #1630

Description

@unbraind

Problem

pm test <id> --run --only-last (and the other selectors) runs one linked test, but the receipt still prints every linked test record in tests[N]. Agents read this receipt after each focused run, so a selective run costs as many tokens as listing the item's whole test collection. On a real fleet item with 58 linked tests, an agent reported that every --only-last run printed all 58 records.

Reproduction (pm 2026.10.28, fresh non-git workspace)

pm init demo --defaults --agent-guidance skip
id=$(pm create "Only last repro item" --type Task --description d --json | jq -r .item.id)
for i in 1 2 3 4; do pm test "$id" --add command="node -e 'process.exit(0)' # t$i",timeout_seconds=30; done
pm test "$id" --run --only-last

Output (trimmed):

tests[4]{command,scope,timeout_seconds,provenance{...}}:
  node -e 'process.exit(0)' # t1,...
  node -e 'process.exit(0)' # t2,...
  node -e 'process.exit(0)' # t3,...
  node -e 'process.exit(0)' # t4,...
run_results[1]{command,status,exit_code,stdout,stderr}:
  node -e 'process.exit(0)' # t4,passed,0,"",""
selection:
  selector: "only-last"
  selected_indexes[1]: 4
  selected_count: 1
  skipped_count: 3
warnings[1]: "linked_test_selection:only-last=last;selected=1;skipped=3;indexes=4"
...
execution_context: { ...8 more lines... }

Expected

When a selector narrows the run, the default receipt contains only the selected tests (or no tests[] at all, since run_results already names the command), plus count and the selection block for the skipped ones. The full collection stays available with an explicit flag such as --full/--include-linked, as other read commands do with budgets.

The same selection facts are also repeated as a warnings[] string, which is redundant for a successful, explicitly requested selection.

Why it matters

pm's job for agents is context management. A focused run is the moment an agent wants the smallest receipt, and today it gets the largest one. This is the same class as the budgeted reads elsewhere in the CLI: omitted collections should be summarized, not dumped.

Activity

  1. unbraind commented on Oct 30, 2026

    @unbraind
    OwnerAuthor

    Tracked in pm-gh1630.

    Selective linked-test receipt budgeting, restoration of full evidence, and nonredundant selection facts. The item is open and unclaimed, with duplicate-check, planning and relationship evidence recorded.

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