Skip to content

feat: add ignore_drafts option to filter draft PRs from inbox#11

Merged
mgreau merged 2 commits into
mgreau:mainfrom
jmeridth:feat/ignore-drafts
May 11, 2026
Merged

feat: add ignore_drafts option to filter draft PRs from inbox#11
mgreau merged 2 commits into
mgreau:mainfrom
jmeridth:feat/ignore-drafts

Conversation

@jmeridth

@jmeridth jmeridth commented May 8, 2026

Copy link
Copy Markdown
Contributor

What

Adds an ignore_drafts config field (default false) and a matching --ignore-drafts flag on zen inbox. When enabled, draft PRs are filtered out of inbox results, watch-daemon poll output, and the MCP zen_inbox tool. The filter is applied at the GitHub search layer: draft:false for GraphQL queries and --draft=false for gh pr list.

Also adds a callout in docs/mcp.md clarifying that the MCP zen_inbox tool reads ignore_drafts from config only, with no per-call override (unlike the CLI flag).

Why

Avoid spending review attention on PRs that aren't ready for review. The CLI flag overrides the persisted config in either direction for single-run experiments.

Notes

  • The setting is honored by the watch daemon and MCP zen_inbox tool, not just zen inbox. A user enabling this will also stop receiving daemon notifications for drafts. Consistent on purpose, but worth flagging during review.
  • Default behavior is unchanged for existing configs (drafts still shown). The YAML zero value (false) for the new bool naturally preserves prior behavior, so no pointer/getter dance needed.
  • The flag uses cmd.Flags().Changed("ignore-drafts") so it only overrides config when explicitly set; bare zen inbox always uses config.
  • --draft=false is a documented gh pr list flag, no new dependency.
  • MCP zen_inbox intentionally has no per-call override parameter; toggling requires a config change. Documented in docs/mcp.md.

Testing

  • New unit tests:
    • TestLoadIgnoreDrafts — verifies omitted/true/false YAML round-trip into Config.IgnoreDrafts.
    • TestBuildReviewRequestQueries — confirms draft:false is appended to both review-requested and re-review GraphQL search strings under all repo-filter combinations.
    • TestBuildApprovedUnmergedQuery — same coverage for the approved-unmerged query.
  • Existing *_timeoutError tests updated for the new ignoreDrafts parameter.
  • go vet ./..., go test ./..., go build ./... all pass.
  • Manual verification done locally: zen inbox --ignore-drafts against a repo with open draft PRs to confirm end-to-end behavior with the live gh CLI. Also worked with config option set to true.

## What

Adds an `ignore_drafts` config field (default false) and a matching
`--ignore-drafts` flag on `zen inbox`. When enabled, draft PRs are
filtered out of inbox results, watch-daemon poll output, and the MCP
inbox tool. The filter is applied at the GitHub search layer:
`draft:false` for GraphQL queries and `--draft=false` for `gh pr list`.

## Why

Avoid spending review attention on PRs that aren't ready for review.
The CLI flag overrides the persisted config in either direction for
single-run experiments.

## Notes

- The setting is honored by the watch daemon and MCP zen_inbox tool, not just zen inbox — a user enabling this will also stop receiving daemon notifications for drafts. Consistent on purpose, but worth flagging.
- Default behavior is unchanged for existing configs (drafts still shown).
- The flag uses cmd.Flags().Changed("ignore-drafts") so it only overrides config when explicitly set; bare zen inbox always uses config.
- --draft=false is a documented gh pr list flag; no new dependency.

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth marked this pull request as ready for review May 8, 2026 14:44
@jmeridth

jmeridth commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@mgreau I may want to flip this to be --open-only (ignores drafts and merged). wdyt?

@mgreau mgreau self-requested a review May 11, 2026 13:09

@mgreau mgreau left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM — clean, well-scoped change with good test coverage.

On your question about flipping to --open-only: I'd keep --ignore-drafts.

The inbox search queries already pin is:pr is:open, so merged PRs are never in the result set today — GetReviewRequests, GetApprovedUnmerged, and ListOpenPRs all constrain to open. That means --open-only would functionally do exactly what --ignore-drafts does (filter drafts) but with a name that implies it's also responsible for excluding merged, which is actually is:open's job. The current name describes exactly what the flag does.

The only surface that shows merged PRs is zen status / dashboard, but that's a different code path entirely (local worktrees enriched via GetPRState, not a GitHub search), and merged worktrees stay visible there on purpose so you can clean them up before the watch daemon's cleanup pass. If you ever want to hide those, that'd be a separate flag on status, not a rename here.

One small non-blocking thing: the MCP zen_inbox tool has no per-call override and always uses s.cfg.IgnoreDrafts. Reasonable to keep the MCP surface minimal, but worth a one-line note in docs/mcp.md so anyone reading the CLI docs first doesn't get surprised.

## What

Add a callout to docs/mcp.md clarifying that the zen_inbox MCP tool
reads ignore_drafts from config only, with no per-call parameter
override.

## Why

The CLI accepts --ignore-drafts as a per-run flag while the MCP
handler reads s.cfg.IgnoreDrafts directly. A reader coming from the
CLI docs could reasonably expect the same toggle on the tool call
and be surprised when it isn't there.

## Notes

- Documentation only, no behavior change.
- If a per-call override is added later, this note should be removed
  rather than amended.

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth requested a review from mgreau May 11, 2026 14:32
@mgreau mgreau merged commit f4a10b9 into mgreau:main May 11, 2026
1 check passed
@jmeridth jmeridth deleted the feat/ignore-drafts branch May 11, 2026 15:50
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.

2 participants