Skip to content

fix: hide rollout-gated nouns from help until enabled - #395

Merged
allenhutchison merged 4 commits into
Vycari:mainfrom
bniladridas:fix/377-hide-gated-commands
Nov 30, 2026
Merged

allenhutchison merged 4 commits into
Vycari:mainfrom
bniladridas:fix/377-hide-gated-commands

Conversation

@bniladridas

@bniladridas bniladridas commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Human overview

pepper --help advertised graph and stickers to every account, even when the server had not turned those rollouts on, so running one only produced a 404. Help now reads GET /api/v1/rollouts for the selected login and leaves each noun out until its key is listed (entity-graph, achievements), including for pepper graph --help and pepper stickers --help. A failed read shows every command rather than blocking help, and both nouns stay runnable so the server still answers. Fixes #377.

AI reviewer

Details for agents: what the diff does, invariants, verification, checklist

What the diff does

src/pepper_cli/api_client.py:

  • ApiClient.rollout_keys() reads GET /api/v1/rollouts and returns the keys as a frozenset[str]. Non-string entries are dropped, so a future key the client does not know cannot break the read. A 404 returns an empty set, matching the server-first rule that an older server has no rollout endpoint. Any other error, including a body without a list under rollouts, raises.

src/pepper_cli/cli.py:

  • _GATED_COMMANDS maps graph to entity-graph and stickers to achievements in one place.
  • _hidden_gated_commands() loads the selected profile's credentials and returns the nouns whose key is absent. No credentials, an unreadable credentials file (OSError), a proxy error, a transport error, an API error, or a 426 all hide nothing, so help still prints. UpgradeRequiredError is deliberately caught here because it is not an ApiError and main()'s handler for it wraps command handlers, not the parser build. Real commands still raise it and get their upgrade message. A 404 is handled inside rollout_keys as an empty list and does hide the nouns, per the documented older-server rule. The read runs on a daemon worker with one monotonic deadline, because httpx timeouts are per network step; a slow server cannot hold help past the 2 second budget, and the worker gets the remaining budget as its own timeout so it winds down by itself.
  • _is_help_option() recognizes -h, --help, and the unambiguous long prefixes argparse accepts (--h, --he, --hel). _help_target() detects root help and help for either gated noun, including pepper graph list --help. The rollout read runs for those invocations, so pepper graph --help omits the noun's verbs when entity-graph is off. Help for ungated nouns and every non-help command performs no read. --help=x is an argparse error, not a help request.
  • main() consumes and applies a leading --profile before building the parser, so the read uses that login. _misplaced_profile() rejects any other --profile before help can filter by the default login's keys, using the same _UNAPPLIED_PROFILE text and exit 2 as argparse's _RejectUnappliedProfile. This restores the fail-closed rule for pepper --help --profile work, where the help action otherwise exits before argparse sees the option.
  • _add_gated_subparser() and the graph verb helper omit the help keyword for hidden nouns and verbs. add_parser still registers them, so they remain in _build_parser()[1], parse normally, and dispatch to their handlers. Only the help lists stop advertising them. The graph subparser uses an explicit metavar when hidden so the usage line does not list names that are absent from the help list.

Tests in tests/test_cli_rollout_gates.py cover the client read (list, 404, wrong type, missing field, invalid JSON), both keys present, each key independently absent, an older server's 404, a 500, a 426 with a minimum version, an unreachable host, a stalled endpoint stopped at the overall deadline, no credentials, an unreadable credentials file (PermissionError and OSError), a named profile, --profile after help, one read per invocation, abbreviated root and graph help, gated noun help with and without the key, a gated leaf noun's help, no read for ungated noun help, and that a hidden noun and its verbs still parse and dispatch.

Invariants: help always prints, even with no credentials, an unreadable credentials file, or a dead server. Running a command never waits on the rollout read. Unknown rollout keys are ignored. The command surface, its arguments, and its server contract are unchanged; only help output is filtered.

Alternatives rejected: help=argparse.SUPPRESS does not work for subparsers on Python 3.13; the formatter prints the pseudo-action with ==SUPPRESS== as its text, which is why the keyword is omitted instead. Clearing argparse's private _choices_actions was tried instead of omitting help and dropped because Ruff's SLF001 rejects private member access and this repo does not add lint ignores. Removing the parser when hidden would turn pepper stickers into implicit chat, so the nouns must stay registered. Applying a trailing --profile would add a second accepted position; README says --profile is honored only as the first argument, so it is rejected instead.

The issue left open whether a help-time network read is acceptable. This takes its primary plan: root and gated-noun help only, one read, a 2 second cap, and fail open on every failure except the documented 404. The fallback in the issue (always hide the nouns with SUPPRESS) was not taken because it hides enabled features.

Deployment check before the change: curl -sS -o /dev/null -w '%{http_code}' https://pepper.vycari.ai/api/v1/rollouts returned 401 with {"detail":"missing bearer token"}, so the route is live in production. A 404 there would mean it was not deployed.

Failure posture: a wrong read can hide or show a noun in help, or delay help by at most the 2 second timeout. It cannot block a command, change its arguments, or alter API traffic for a real command.

Look hardest at main(): the profile is applied and checked before the parser is built, and the read happens only for the help targets _help_target() returns. That ordering is what makes pepper --profile p --help read p's keys, pepper graph --help filter graph's verbs, and pepper --help --profile work fail instead of using the default login.

Review follow-through: Vycari Review round 1 raised P1 (credentials read error crashes help) and P2 (--profile after --help uses the default login), plus a scope gap on pepper <noun> --help. Those were addressed in 9f317c2. Round 2 re-opened P1 for a 426 in the rollout read, fixed in 313d072; P2 was confirmed resolved. Greptile raised two P2s on 313d072: abbreviated help bypassing the read and a per-step rather than overall timeout, both fixed in 2b6edf9.

Verification, exactly as run after the latest follow-up commit:

  • uv run pytest -q tests/test_cli_rollout_gates.py tests/test_cli.py tests/test_cli_scaffolding.py tests/test_cli_stickers.py tests/test_cli_graph.py tests/test_agent_skill.py tests/test_cli_conformance.py tests/test_user_agent_and_upgrade.py: 622 passed in 43.30s
  • uv run pytest -n auto -q: 4257 passed, 21 skipped in 192.57s
  • uv run pytest -n auto --cov --cov-report=json:coverage-summary.json: 4257 passed, 21 skipped in 342.18s; coverage 95.53% (17800/18633), floor 88
  • uv run ruff format --check: 176 files already formatted
  • uv run ruff check: All checks passed
  • uv run ty check src/pepper_cli/: All checks passed
  • git diff --check: clean, and no em or en dashes in added source lines, the test file, or the commit message
  • No new lint ignores were added
  • No test or check was skipped

Deferred work: none. The bundled SKILL.md stays static, as the issue asks; it documents both commands and already says a 404 means the feature is not on for that account.

Checklist (repo-specific)

  • uv run ruff format --check and uv run ruff check clean (no new lint ignores)
  • uv run ty check src/pepper_cli/ clean
  • uv run pytest passes; coverage floor in .claude/maintainerd.json not lowered
  • Server-contract changes: not applicable, this reads an endpoint already in the vendored contract and changes no wire model
  • No token or credential is logged, printed, or put in a fixture
  • README and the bundled SKILL.md updated if commands or output changed: not applicable, no command or its arguments changed and the skill stays static by design
  • Help: help/cli.md updated for a new or changed command, or not user-facing because the command set and help text are unchanged and the existing rollout markers already describe both nouns

Confidence Score: 5/5 · The PR appears safe to merge; both previous findings are fixed.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; both previous findings are fixed.

Summary

Help now checks the selected login's rollout keys before listing graph and stickers. Both commands remain runnable.

  • Help lists graph and stickers only when their rollout keys are on.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[CLI arguments] --> B[Apply leading profile]
  B --> C{Root or gated command help?}
  C -->|No| D[Build normal parser]
  C -->|Yes| E[Read rollout keys on daemon worker]
  E --> F{Answer before deadline?}
  F -->|Yes| G[Hide commands whose keys are absent]
  F -->|Failure or timeout| D
  G --> H[Build filtered parser]
  D --> I[Parse and dispatch]
  H --> I
Loading

Reviews (2) · Last reviewed commit: "fix: cover abbreviated help and cap the ..." · Reviewed by Greptile

Root help now reads GET /api/v1/rollouts once for the selected login and leaves graph and stickers out of the noun list until the server lists entity-graph and achievements. A 404 from an older server is an empty list and hides them; any other failure, including no credentials, shows every command so help never blocks on the read. Both nouns stay registered and runnable, so a person who knows the command still gets the server's own answer.

Closes Vycari#377

Signed-off-by: Niladri Das <125604915+bniladridas@users.noreply.github.com>
@vycari-review

vycari-review Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Vycari Review

Round 4 on 2b6edf9. The verdict is the Vycari Review check run, and each open finding is an inline thread. Reply on every P0 and P1 thread: Fixed in <sha>, or Disputed: with a reason. P2s are the author's call: fix one, or reply Deferred: #<issue> (the PR's one follow-up issue) or Declined: with a reason, and VR stops re-raising it. From round 2 on, VR raises no new P2s: it checks the fixes and looks for P0s and P1s.

Open: P0 0 · P1 0 · P2 0 · disputed 0 · confirmed fixed 0 · withdrawn 0

Hand-off: Greptile requested on 2b6edf9.

Greptile follow-through

  • P2 · GR-4731563857 · src/pepper_cli/cli.py:765 · fixed (confirmed), thread answered · fixed-confirmed: Greptile said _help_target only recognised exact -h/--help, so argparse-accepted prefixes like --hel built the parser without the rollout read and showed disabled commands. At this head the new _is_help_option accepts -h and any unambiguous prefix of --help (longer than two characters, no =value),…
  • P2 · GR-4731563860 · src/pepper_cli/cli.py:808 · fixed (confirmed), thread answered · fixed-confirmed: Greptile said the 2-second httpx timeout applied to each network step, so a server dripping bytes could hold help open indefinitely. At this head the read runs on a daemon worker thread. The main thread joins it only until one monotonic deadline and falls back to hiding nothing if the worker is sti…

No open findings this round.

P2s, judge's notes and closed findings

Judge's notes

No new findings survived this round, and both open Greptile findings are fixed in the diff. Help now treats short forms like --hel the same as --help, and the help-time rollout read stops at one fixed 2-second deadline.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-29T10:41:14.399196Z
We couldn’t complete this review. Comment @codex review to try again.
4d159e0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread src/pepper_cli/cli.py Resolved
Comment thread src/pepper_cli/cli.py Resolved
Help now reads the rollout list for pepper graph --help and pepper stickers --help as well as pepper --help, and a hidden noun no longer lists the verbs the account cannot use. The credentials read also catches OSError, so an unreadable credentials file prints help instead of a traceback, and a --profile that is not the leading argument is rejected before help can filter by the default login's keys. Hidden nouns stay registered and runnable.

Signed-off-by: Niladri Das <125604915+bniladridas@users.noreply.github.com>
The help-time rollout read now catches UpgradeRequiredError along with the other read failures, so a server requiring a client upgrade cannot turn pepper --help or pepper graph --help into a traceback. Real commands still raise it to the shared handler. A regression test returns 426 from /api/v1/rollouts and asserts root help still prints both gated nouns.

Signed-off-by: Niladri Das <125604915+bniladridas@users.noreply.github.com>
@vycari-review

vycari-review Bot commented Nov 29, 2026

Copy link
Copy Markdown

@greptileai review

Comment thread src/pepper_cli/cli.py Resolved
Comment thread src/pepper_cli/cli.py Resolved
Help detection now accepts the unambiguous long-option prefixes argparse accepts, so pepper --hel and pepper graph --hel get the same rollout filtering as --help. The help-time read also runs on a daemon worker with one absolute deadline, so a slow server cannot hold help open past the two second budget, while real commands are unaffected.

Signed-off-by: Niladri Das <125604915+bniladridas@users.noreply.github.com>
@vycari-review

vycari-review Bot commented Nov 29, 2026

Copy link
Copy Markdown

@greptileai review

@allenhutchison allenhutchison 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.

Thanks for fixing this.

@allenhutchison
allenhutchison added this pull request to the merge queue Nov 30, 2026
Merged via the queue into Vycari:main with commit dd4a678 Nov 30, 2026
5 checks passed
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.

Hide rollout-gated commands (graph, stickers) until GET /api/v1/rollouts lists their key

2 participants