Repository navigation
fix: hide rollout-gated nouns from help until enabled - #395
Conversation
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 ReviewRound 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: Open: P0 0 · P1 0 · P2 0 · disputed 0 · confirmed fixed 0 · withdrawn 0 Hand-off: Greptile requested on 2b6edf9. Greptile follow-through
No open findings this round. P2s, judge's notes and closed findingsJudge'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. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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>
|
@greptileai review |
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>
|
@greptileai review |
allenhutchison
left a comment
There was a problem hiding this comment.
Thanks for fixing this.
Human overview
pepper --helpadvertisedgraphandstickersto every account, even when the server had not turned those rollouts on, so running one only produced a 404. Help now readsGET /api/v1/rolloutsfor the selected login and leaves each noun out until its key is listed (entity-graph,achievements), including forpepper graph --helpandpepper 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()readsGET /api/v1/rolloutsand returns the keys as afrozenset[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 underrollouts, raises.src/pepper_cli/cli.py:_GATED_COMMANDSmapsgraphtoentity-graphandstickerstoachievementsin 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.UpgradeRequiredErroris deliberately caught here because it is not anApiErrorand 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 insiderollout_keysas 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, includingpepper graph list --help. The rollout read runs for those invocations, sopepper graph --helpomits the noun's verbs whenentity-graphis off. Help for ungated nouns and every non-help command performs no read.--help=xis an argparse error, not a help request.main()consumes and applies a leading--profilebefore building the parser, so the read uses that login._misplaced_profile()rejects any other--profilebefore help can filter by the default login's keys, using the same_UNAPPLIED_PROFILEtext and exit 2 as argparse's_RejectUnappliedProfile. This restores the fail-closed rule forpepper --help --profile work, where the help action otherwise exits before argparse sees the option._add_gated_subparser()and the graph verb helper omit thehelpkeyword for hidden nouns and verbs.add_parserstill 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.pycover 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 (PermissionErrorandOSError), a named profile,--profileafter 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.SUPPRESSdoes 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_actionswas tried instead of omittinghelpand dropped because Ruff's SLF001 rejects private member access and this repo does not add lint ignores. Removing the parser when hidden would turnpepper stickersinto implicit chat, so the nouns must stay registered. Applying a trailing--profilewould add a second accepted position; README says--profileis 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/rolloutsreturned401with{"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 makespepper --profile p --helpreadp's keys,pepper graph --helpfilter graph's verbs, andpepper --help --profile workfail instead of using the default login.Review follow-through: Vycari Review round 1 raised P1 (credentials read error crashes help) and P2 (
--profileafter--helpuses the default login), plus a scope gap onpepper <noun> --help. Those were addressed in9f317c2. Round 2 re-opened P1 for a 426 in the rollout read, fixed in313d072; P2 was confirmed resolved. Greptile raised two P2s on313d072: abbreviated help bypassing the read and a per-step rather than overall timeout, both fixed in2b6edf9.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.30suv run pytest -n auto -q: 4257 passed, 21 skipped in 192.57suv run pytest -n auto --cov --cov-report=json:coverage-summary.json: 4257 passed, 21 skipped in 342.18s; coverage 95.53% (17800/18633), floor 88uv run ruff format --check: 176 files already formatteduv run ruff check: All checks passeduv run ty check src/pepper_cli/: All checks passedgit diff --check: clean, and no em or en dashes in added source lines, the test file, or the commit messageDeferred work: none. The bundled
SKILL.mdstays 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 --checkanduv run ruff checkclean (no new lint ignores)uv run ty check src/pepper_cli/cleanuv run pytestpasses; coverage floor in.claude/maintainerd.jsonnot loweredSKILL.mdupdated if commands or output changed: not applicable, no command or its arguments changed and the skill stays static by designhelp/cli.mdupdated 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.Summary
Help now checks the selected login's rollout keys before listing
graphandstickers. Both commands remain runnable.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 --> IReviews (2) · Last reviewed commit: "fix: cover abbreviated help and cap the ..." · Reviewed by Greptile