Repository navigation
fix(cli): add show verb that resolves provider:id directly - #482
Conversation
Closes #422. `polylogue codex:abc show` previously concatenated `show` into the FTS query (no `show` verb existed), producing a ~95s search timeout that returned no results despite the conversation being in the archive. Register `show` as a query verb that mirrors `open`'s positional-id handling: when the candidate set (parent query terms + verb target terms) is a single token containing a colon, route to a direct conv_id lookup instead of the search path. Both argument orders now resolve in seconds: polylogue codex:abc show polylogue show codex:abc Non-id terms still fall through to the search path unchanged. Verification: - pytest tests/unit/cli/ -q (844 passed) - devtools verify --quick (all checks passed) - live: polylogue --plain --limit 1 claude-code:8d821a23-10a show resolves the conversation in ~3s Co-Authored-By: Claude <[email protected]>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 25 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new CLI command Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1fe34e6e9
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
polylogue/cli/query_verbs.py (2)
76-107: 🧹 Nitpick | 🔵 TrivialExtract shared positional-id resolution to remove duplication.
open_verbandshow_verbnow carry near-identical id-extraction rules. A small helper centralizes the policy and makes future tweaks (e.g., stripping aprovider:prefix, supporting hash-only ids) a single-site change.♻️ Suggested helper
+def _resolve_positional_id( + parent_terms: tuple[str, ...], target_terms: tuple[str, ...] +) -> str | None: + """Return the single ``provider:id`` candidate spanning parent + target terms, if any.""" + candidates = parent_terms + target_terms + if len(candidates) == 1 and ":" in candidates[0]: + return candidates[0] + return NoneBoth verbs then call
_resolve_positional_id(_parent_query_terms(ctx), target_terms)and route toconv_idwhen non-None.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@polylogue/cli/query_verbs.py` around lines 76 - 107, open_verb and show_verb duplicate the same positional-id extraction logic; add a helper _resolve_positional_id(parent_terms: tuple[str,...], target_terms: tuple[str,...]) -> Optional[str] that encapsulates the rule (e.g., single token containing ":" or other future rules) and update both open_verb and show_verb to call this helper: if it returns a conv_id, route via _execute_query_verb using request.with_param_updates(conv_id=conv_id) (for open_verb) or request.with_query_terms(()).with_param_updates(conv_id=conv_id) (for show_verb), otherwise fall back to request.append_query_terms(target_terms) as before; use _parent_query_terms(ctx), target_terms, _execute_query_verb, and request.* methods to locate the call sites to change.
76-86:⚠️ Potential issue | 🟠 Major
open_verbhas the same parent-terms FTS bug thatshow_verbnow fixes.
show_verbresolves a positional id fromparent_terms + target_terms(combined length 1).open_verbonly resolves it whenparent_termsis empty and the id appears intarget_terms. As a result,polylogue codex:abc openstill routescodex:abcthrough FTS (the exact bug profile of issue#422forshow), even thoughpolylogue codex:abc showis now fixed. The PR description statesshow"mirrorsopen’s positional-id behavior", but the fix is actually a superset ofopen's logic — leavingopeninconsistent.Recommend extending the same fix to
open_verbso the two verbs behave uniformly:🔧 Proposed fix for `open_verb`
def open_verb(ctx: click.Context, print_path: bool, target_terms: tuple[str, ...]) -> None: """Open matched conversation in browser/editor.""" request = _parent_request(ctx).with_param_updates(open_result=True, print_path=print_path) - if not _parent_query_terms(ctx) and len(target_terms) == 1 and ":" in target_terms[0]: - _execute_query_verb(ctx, request.with_param_updates(conv_id=target_terms[0])) + parent_terms = _parent_query_terms(ctx) + candidates = parent_terms + target_terms + if len(candidates) == 1 and ":" in candidates[0]: + _execute_query_verb( + ctx, + request.with_query_terms(()).with_param_updates(conv_id=candidates[0]), + ) return _execute_query_verb(ctx, request.append_query_terms(target_terms))Also applies to: 89-107
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@polylogue/cli/query_verbs.py` around lines 76 - 86, open_verb currently only treats a single positional conv id when parent_terms is empty, so inputs like "polylogue codex:abc open" still go through FTS; mirror the fix from show_verb by combining the parent query terms and target_terms, check if their combined length is 1 and the single term contains ":" and then call _execute_query_verb with request.with_param_updates(conv_id=that_term) instead of appending to FTS; update the logic in open_verb (and the similar block around lines 89-107) to use _parent_query_terms(ctx) + list(target_terms) (or equivalent) and resolve the positional id via with_param_updates(conv_id=...) when that combined condition holds.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/unit/cli/test_query_verbs_runtime.py`:
- Line 167: Replace the loose disjunction assertion with a direct check that the
request query parameters do not contain the conv_id key; specifically, in the
test referencing request.query_params() and conv_id, change the assertion to
assert "conv_id" not in request.query_params() so the fallback path of show_verb
is validated to never populate conv_id.
---
Outside diff comments:
In `@polylogue/cli/query_verbs.py`:
- Around line 76-107: open_verb and show_verb duplicate the same positional-id
extraction logic; add a helper _resolve_positional_id(parent_terms:
tuple[str,...], target_terms: tuple[str,...]) -> Optional[str] that encapsulates
the rule (e.g., single token containing ":" or other future rules) and update
both open_verb and show_verb to call this helper: if it returns a conv_id, route
via _execute_query_verb using request.with_param_updates(conv_id=conv_id) (for
open_verb) or request.with_query_terms(()).with_param_updates(conv_id=conv_id)
(for show_verb), otherwise fall back to request.append_query_terms(target_terms)
as before; use _parent_query_terms(ctx), target_terms, _execute_query_verb, and
request.* methods to locate the call sites to change.
- Around line 76-86: open_verb currently only treats a single positional conv id
when parent_terms is empty, so inputs like "polylogue codex:abc open" still go
through FTS; mirror the fix from show_verb by combining the parent query terms
and target_terms, check if their combined length is 1 and the single term
contains ":" and then call _execute_query_verb with
request.with_param_updates(conv_id=that_term) instead of appending to FTS;
update the logic in open_verb (and the similar block around lines 89-107) to use
_parent_query_terms(ctx) + list(target_terms) (or equivalent) and resolve the
positional id via with_param_updates(conv_id=...) when that combined condition
holds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: b56cfc5f-948a-442e-8079-ba350efb4182
📒 Files selected for processing (7)
docs/cli-reference.mddocs/test-quality-workflows.mddocs/verification-catalog.mdpolylogue/cli/query_verbs.pytests/unit/cli/__snapshots__/test_terminal_snapshots.ambrtests/unit/cli/test_click_app.pytests/unit/cli/test_query_verbs_runtime.py
|
|
||
| request = execute.call_args.args[1] | ||
| assert isinstance(request, RootModeRequest) | ||
| assert "conv_id" not in request.query_params() or not request.query_params().get("conv_id") |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Tighten the fallback assertion.
The disjunction "conv_id" not in ... or not ...get("conv_id") is broader than needed and obscures the contract. In the fallback path, show_verb must not populate conv_id, so assert that directly.
♻️ Proposed assertion
- assert "conv_id" not in request.query_params() or not request.query_params().get("conv_id")
+ assert request.query_params().get("conv_id") is None📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| assert "conv_id" not in request.query_params() or not request.query_params().get("conv_id") | |
| assert request.query_params().get("conv_id") is None |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/unit/cli/test_query_verbs_runtime.py` at line 167, Replace the loose
disjunction assertion with a direct check that the request query parameters do
not contain the conv_id key; specifically, in the test referencing
request.query_params() and conv_id, change the assertion to assert "conv_id" not
in request.query_params() so the fallback path of show_verb is validated to
never populate conv_id.
The new ``show`` verb introduced in this PR exposes a new ``help-show`` showcase exercise via the auto-discovered help-N catalog. Commit the captured baseline and refresh ``help-main`` to include the verb in the top-level command listing. Co-Authored-By: Claude <[email protected]>
Three baselines drifted after the show/export/bulk-export fixes landed: - help-show: show verb body rewritten (#482) - help-export: gained provider:id-prefix note (#483) - help-main: show description text adjusted (#482) Master CI (showcase-verify) has been red since 6b5c392. Refreshing the baselines unblocks PRs that depend on a green master. Verification: `devtools lab-scenario verify-baselines` exits 0. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
## Summary - Register `show` as a query verb so `polylogue <provider:id> show` resolves directly by id instead of falling into FTS. - Mirror `open`'s positional-id pattern, but accept the id from either the parent query terms (`<id> show`) or the verb's target terms (`show <id>`). - Update CLI help snapshots and generated catalogs (cli-reference, verification-catalog, test-quality-workflows) to include the new verb. Closes #422. ## Problem Before this change, `polylogue codex:019dbae3-... show` exited after ~95s with `No conversations matched filters: search: codex:019dbae3-... show`. Root cause: there was no `show` verb registered, so the bare-token interception in `_split_query_mode_args` swept both `codex:...` and `show` into `query_terms`, ran the concatenated string as an FTS search, and timed out. The conversation existed in the archive (visible via `list`); only the surface was broken. ## Solution `polylogue/cli/query_verbs.py`: - Add `show_verb`. When the parent query terms plus the verb's positional `target_terms` collapse to exactly one token containing `:`, set `conv_id` and clear the query terms — direct id lookup, prefix match handled by `_apply_runtime_filters`. Otherwise append `target_terms` to existing query terms (preserving the search path). - Add `"show"` to `VERB_NAMES` so `_split_query_mode_args` recognizes it as a verb at any position (matching `list`, `count`, `stats`, `open`, `delete`). - Add `show_verb` to `QUERY_VERBS` so it's registered with the root group. Other surfaces: - `tests/unit/cli/test_query_verbs_runtime.py`: three new tests covering id-from-target-terms, id-from-parent-query-terms (the regression), and search fallback for non-id terms. - `tests/unit/cli/test_click_app.py`: extend the registered-commands assertion. - `tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr`: refreshed via `--snapshot-update` (help now lists `show`). - `docs/cli-reference.md`, `docs/verification-catalog.md`, `docs/test-quality-workflows.md`: regenerated by `devtools render-all`. ## Verification ``` nix develop -c pytest tests/unit/cli/ -q # 844 passed nix develop -c devtools verify --quick # all checks passed nix develop -c pytest -q --ignore=tests/integration # 5570 passed, 10 xfailed # (1 unrelated flaky pass on re-run: # test_async_backend_schema_and_lock_contracts) ``` End-to-end: ``` $ time polylogue --plain --limit 1 claude-code:8d821a23-10a show # investigate open issues and propose a set you'd tackle next ... Provider: claude-code Conversation ID: claude-code:8d821a23-10a6-4aa9-9c1f-ce5c7086f784 real 0m3.12s ``` (Was ~95s timeout with no results before this change.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a new `show` command to display matched conversation content via existing query execution paths. * **Documentation** * Updated CLI reference with documentation for the new `show` command. * **Tests** * Updated test snapshots and assertions to include the new `show` command. * Added runtime tests validating the new command's routing behavior for conversation lookups. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
showas a query verb sopolylogue <provider:id> showresolves directly by id instead of falling into FTS.open's positional-id pattern, but accept the id from either the parent query terms (<id> show) or the verb's target terms (show <id>).Closes #422.
Problem
Before this change,
polylogue codex:019dbae3-... showexited after ~95s withNo conversations matched filters: search: codex:019dbae3-... show. Root cause: there was noshowverb registered, so the bare-token interception in_split_query_mode_argsswept bothcodex:...andshowintoquery_terms, ran the concatenated string as an FTS search, and timed out. The conversation existed in the archive (visible vialist); only the surface was broken.Solution
polylogue/cli/query_verbs.py:show_verb. When the parent query terms plus the verb's positionaltarget_termscollapse to exactly one token containing:, setconv_idand clear the query terms — direct id lookup, prefix match handled by_apply_runtime_filters. Otherwise appendtarget_termsto existing query terms (preserving the search path)."show"toVERB_NAMESso_split_query_mode_argsrecognizes it as a verb at any position (matchinglist,count,stats,open,delete).show_verbtoQUERY_VERBSso it's registered with the root group.Other surfaces:
tests/unit/cli/test_query_verbs_runtime.py: three new tests covering id-from-target-terms, id-from-parent-query-terms (the regression), and search fallback for non-id terms.tests/unit/cli/test_click_app.py: extend the registered-commands assertion.tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr: refreshed via--snapshot-update(help now listsshow).docs/cli-reference.md,docs/verification-catalog.md,docs/test-quality-workflows.md: regenerated bydevtools render-all.Verification
End-to-end:
(Was ~95s timeout with no results before this change.)
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
showcommand to display matched conversation content via existing query execution paths.Documentation
showcommand.Tests
showcommand.