Repository navigation
feat(dev-api): add /v1/dev/user/ask and omi ask CLI - #11452
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Clean replacement for conflicted #10314 is now open on current Edited to remove a stray |
There was a problem hiding this comment.
All reported issues were addressed across 10 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for opening the clean replacement for #10314. The shape is useful, and the PR preserves several important safeguards, but I think the new endpoint should be fixed before merge.
Blocking issues:
backend/routers/developer.py:DeveloperAskRequest.timezoneis documented as an IANA timezone, but it is accepted as any string and passed directly toqa_rag(..., tz=request.timezone). For a user-facing ask endpoint, invalid or oversized timezone input should be validated at the API boundary (for example withZoneInfo, returning 422/400 or a deliberate UTC fallback) so relative-date answers do not silently use bad temporal context.backend/routers/developer.py:ask_conversations()callssearch_conversations()without catchingConversationSearchUnavailableError. The existing/v1/conversations/searchroute maps that transient Typesense failure to503 Search temporarily unavailable; this endpoint would currently bubble the upstream failure into a generic 500 for CLI/API callers.backend/routers/developer.py: retrieval is still onlyutils.conversations.search.search_conversations(), whosequery_byisstructured.overview, structured.title. Because this endpoint is supposed to answer questions from conversations, transcript-only facts can be missed before RAG even runs. The backend already has transcript-chunk/search support for other tool surfaces; this endpoint needs equivalent retrieval coverage or a consciously documented narrower contract.
File-by-file notes:
.github/scripts/product_file_line_count_ratchet_baseline/backend-routers.json: the ratchet update is consistent with the added developer router lines and includes a specific justification for the new route.backend/dependencies.py: addingget_uid_with_conversations_read_ask()is the right place to enforceconversations:readplus a dedicated billable-endpoint rate-limit policy.backend/route_policy_manifest.yaml: the manifest correctly records/v1/dev/user/askas developer-api-key auth withconversations:read,dev:ask, and conversations data-domain ownership.backend/routers/developer.py: the read-only locked/discarded filtering is good, but the timezone validation, transient search-error handling, and transcript-search coverage above need changes.backend/scripts/export_openapi.py: explicitly excluding this Developer-API-key-only route from the Firebase app-client OpenAPI contract is the right docs/client-generation boundary.backend/tests/unit/test_dev_ask_endpoint.py: good coverage for grounding, no-context no-LLM behavior, discarded/locked filtering, rate limiting, and app-client OpenAPI exclusion; please add tests for invalid timezone handling,ConversationSearchUnavailableError-> 503, and transcript-only evidence retrieval.backend/utils/rate_limit_config.py: the dedicateddev:askcap matches the billableqa_ragnature of the endpoint and is no looser than conversation creation.docs/api-reference/openapi.json: the generated public OpenAPI correctly exposesdeveloperApiKeyfor/v1/dev/user/ask, but this agent-consumed contract will teach SDKs/coding agents thattimezoneis a free string until the backend schema validates or constrains it.sdks/python-cli/omi_cli/main.py: theomi askcommand is straightforward and forwardsquestion,limit, andtimezoneto the new endpoint while supporting JSON output.sdks/python-cli/tests/test_ask.py: the CLI tests cover normal rendering and JSON mode; adding an option-boundary test for--timezonewould be useful once backend validation is defined.
I tried to run the focused backend and CLI tests locally, but this checkout/environment did not have the backend/CLI test dependencies installed (firebase_admin missing for the backend test import, and the CLI test run collected no tests in this environment). CI is green, but the missing cases above are production-path gaps rather than local harness-only failures.
Because this adds a new conversation-RAG Developer API and public OpenAPI/CLI surface, the endpoint also needs human maintainer sign-off for product/security direction after the implementation fixes.
Automated maintainer review.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
kodjima33
left a comment
There was a problem hiding this comment.
Dev-API ask endpoint + CLI looks well-scoped with a rate-limit policy and a unit test; new capability, so approve-only. Needs a rebase — conflicts with main.
|
@Git-on-my-level @kodjima33 @beastoin re-review requested on head Addressed all three current blockers:
Added regression coverage for invalid timezone, search outage -> 503, and transcript-only retrieval. Focused endpoint suite: 9 passed; Black clean. Please re-review after CI. Edited to remove a stray |
|
@Git-on-my-level @kodjima33 current- The three earlier blockers remain in place on this tip:
|
|
The latest backend-unit failure is outside the #11452 diff and appears flaky/timing-sensitive on current main: |
|
@Git-on-my-level re-review on head Your three blockers (IANA timezone, 503 on retrieval failure, transcript retrieval) are on this tip. The previous Backend unit suite red was unrelated Author-side is MERGEABLE. Product/security merge after your dismiss. |
|
rebase attempt: I replayed the actual PR branch onto current origin/main and resolved the obsolete backend-routers ratchet deletion. The resulting branch is clean, 9 files / +549 lines, and retains the timezone validation, 503 mapping, transcript-chunk retrieval, endpoint tests, and CLI tests. Force-push is currently blocked by the contributor OAuth token lacking the GitHub workflow scope because current main includes .github/workflows/desktop-swift-ci.yml. No remote change was made; please rebase/push from a token with workflow scope, then re-review/dismiss the stale CHANGES_REQUESTED. |
a9cac74 to
5a36390
Compare
|
@Git-on-my-level @kodjima33 @beastoin the rebased branch is now pushed successfully at |
|
@Git-on-my-level @kodjima33 added the required line-count exception to the PR body: |
|
@Git-on-my-level ready for re-review — all three blockers from your CHANGES_REQUESTED (on
Local: Please dismiss CHANGES_REQUESTED / re-approve when you have a moment. kodjima33 already APPROVED. |
PR body now declares backend/routers/developer.py | 2111 -> 2225 to match current main.
|
Hygiene follow-up: PR body Line-Count-Exception base bumped to match current main ( Earlier CR items look addressed on tip (IANA |
|
Hygiene was still red because the line-count ratchet uses the synthetic merge of tip× Pushed |
|
@Git-on-my-level re-review / dismiss CHANGES_REQUESTED — tip Verified your three blockers against this tip:
Local: Author-side clear — please dismiss CR / re-approve when you have a moment. |
kodjima33
left a comment
There was a problem hiding this comment.
feat(dev-api) /v1/dev/user/ask + omi ask CLI — feature, approve-only per policy
|
Nik (@kodjima33) has approved this head with write-access ( All three blockers from David’s prior review are verified resolved on tip
@Git-on-my-level Please dismiss the stale |
# Conflicts: # backend/routers/developer.py
Reviewer note on BasedHardware#11452 asked for an option-boundary test once backend timezone validation was defined. It now is (DeveloperAskRequest rejects non-IANA values), so this pins the CLI half of the contract: the default is UTC and an explicit --timezone is forwarded verbatim rather than pre-screened client-side, where a second IANA list would drift from the server's ZoneInfo database. Verified the test guards rather than decorates: hardcoding "UTC" in main.py's request body fails it (assert 'UTC' == 'Asia/Kolkata'); restored and the file's 3 tests pass.
|
@Git-on-my-level all three blocking items from your review are resolved, plus the one non-blocking note. Flagging because the request-changes is still on file and now predates the fixes. 1. 2. 3. Transcript-only facts missed before RAG — retrieval is no longer summary-only. Non-blocking note, now closed — you said a CLI I checked that test guards rather than decorates — hardcoding Restored, and On your local-harness note: The human sign-off you reserved for the new Developer API / public OpenAPI / CLI surface is still open and is the right call. Please dismiss the stale request-changes when you next pass. On the two red Swift checks — resolved, no longer applicable. They were Current head So the only thing standing between this and mergeable is the Edited to replace the stale paragraph about the two red Swift checks: both root causes have since landed on |
Desktop Swift Static & Test Contracts failed on SuggestedTasksStoreTests.testNotMineAndAlreadyHandledPersistReasonAndResolveCandidate, a task-intelligence test in a subsystem this PR does not touch. The same CI window produced two other unrelated Swift test failures on other PRs, each a different test. No code change.
kodjima33
left a comment
There was a problem hiding this comment.
Re-approved on latest commit: dev-api /v1/dev/user/ask + omi ask CLI — read-only, budget-gated (25/hr), scoped to conversations:read; feature (not bug fix) so approve-only per policy, not merge. CI green.
Addressed review (David CR 2026-08-12)
ZoneInfoat the API boundaryConversationSearchUnavailableError→ 503 (parity with/v1/conversations/search)Summary
Clean current-main replacement for #10314. Adds the read-only
/v1/dev/user/askDeveloper API endpoint andomi askCLI command, grounded in cited conversation RAG.Security and cost controls
dev:askper-key budget (25/hour).conversations:read.Verification
backend/tests/unit/test_dev_ask_endpoint.py: 9 passed locally on tip.Honest gaps
respxsuite and OpenAPI export not re-run locally in this environment; CI is the gate.Failure-Class: none
Line-Count-Exception: backend/routers/developer.py | 2126 -> 2244 | Adds the read-only developer Ask endpoint with scoped retrieval, rate limiting, and locked/discarded conversation safeguards.
Supersedes stale conflicted #10314 with the same intended implementation on current
main.