Skip to content

fix(talk): require document indexing before voice startup - #6638

Merged
kovtcharov-amd merged 1 commit into
amd:mainfrom
Drchennnn:fix/talk-required-rag
Nov 7, 2026
Merged

kovtcharov-amd merged 1 commit into
amd:mainfrom
Drchennnn:fix/talk-required-rag

Conversation

@Drchennnn

Copy link
Copy Markdown
Contributor

Closes #3481

Summary

Voice chat now refuses to start when a requested document cannot be indexed, rather than silently answering without its context.

Why

The voice guide installed only the talk extra, while document indexing also needs RAG dependencies. Other indexing errors had the same silent fallback.

Changes

  • Document the amd-gaia[talk,rag] install and make the runtime install hint work outside a source checkout.
  • Stop required-document startup on indexing failure; keep explicit enable_rag() calls returning a boolean.
  • Add 12 regression cases and update the relevant documentation.

Test plan

  • 59 focused tests passed on upstream base 1afdf340.
  • Changed Python files passed focused formatting and lint checks; git diff --check passed.
  • Real CLI failure-path reproduction exited 1 before voice startup.
  • Full unit suite collection was blocked locally by missing native PortAudio.
  • Aggregate lint reported existing Windows ctypes errors in unchanged files; a separate full Black check passed all 2,042 Python files.
  • Successful live microphone/speaker/Lemonade document Q&A was not tested; success-path regression tests use mocked model/audio clients.

Evidence

With gaia talk --index in an environment without RAG dependencies, the original code warned and continued into voice startup. With the fix, it reported the package installation command and exited with status 1 before starting voice chat. A second run with RAG installed and a read-only state directory also exited before voice startup.

Command:

gaia talk --index tests/fixtures/gaia/tiers_documents/vendor_quotes/cobalt_quote.pdf --no-tts --no-lemonade-check --base-url http://127.0.0.1:9/api/v1

Output after the fix:

WARNING | RAG dependencies not available. Install with: uv pip install "amd-gaia[talk,rag]"
Error: gaia talk failed: Could not index the requested documents for voice chat. Check the RAG error above and retry.

Exit status: 1. No "Starting voice chat" message.

Checklist

  • Linked the issue and explained the change.
  • Ran focused tests and recorded full-suite limitations.
  • Included real CLI failure-path evidence.
  • Updated documentation for the user-visible behavior.

Stop requested-document voice sessions when indexing fails, and document the talk and RAG extras needed for document Q&A.

Closes amd#3481
@github-actions github-actions Bot added documentation Documentation changes talk Talk agent changes tests Test changes labels Nov 4, 2026
@Drchennnn
Drchennnn marked this pull request as ready for review November 7, 2026 03:52
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve

gaia talk --index <doc> used to warn and start voice chat even when the document never got indexed, so users ended up talking to a session that didn't know about their file. With this PR it stops with a clear error and the right install command. Callers that use enable_rag() directly still get the same true/false result as before. The change is small and well tested, and every doc that describes the behavior is updated. Nothing blocks the merge.

Real-world evidence

N/A: no evidence bundle was produced for this run. The PR description includes the author's own CLI run of the failure path: it prints the amd-gaia[talk,rag] install hint, exits 1, and never prints "Starting voice chat". Beyond that, this verdict rests on static review. The success path with a real microphone, speaker and Lemonade was not exercised; the author says so too.

🔍 Technical details

Issues found: none blocking.

Checks done

  • Sibling paths: TalkSDK(...) is built in only one place, the talk branch of src/gaia/cli.py. The RuntimeError is raised before print("Starting voice chat...") and start_voice_session(). The CLI test asserts exit code 1 and that the session is never awaited.
  • Partial indexing: AgentSDK.enable_rag (src/gaia/chat/sdk.py:1228) returns indexed_count == document_count. So if one document out of several fails, startup is refused, which matches the docs' "if any document" wording.
  • Install hint: AgentSDK.enable_rag still raises its own message, uv pip install -e ".[rag]" (src/gaia/chat/sdk.py:1190). The talk wrapper catches it and logs the new package-install hint, so talk users never see the old source-checkout command. gaia chat users still do. That's outside this PR's scope and worth a separate tidy-up.
  • Docs: the guide, the CLI reference, the SDK agent page and the spec all state the new behavior. The #document-qa-with-voice anchor in the error URL resolves to ## Document Q&A with Voice in docs/guides/talk.mdx. Both the talk and rag extras exist in setup.py.
  • Known bug classes: this change fixes a "dishonest status" case: a requested document that silently failed to index used to look like success. No new waits, subprocesses or shared state.

🟢 Generic RAG failures lose the install hint (src/gaia/talk/sdk.py:401): if the RAG package is missing an optional native library and fails while it is being set up rather than when it is imported, the error falls into the generic except Exception and logs only Failed to enable RAG: …. The new RuntimeError still stops startup, so this is cosmetic.

Strengths

  • The tests drive the real gaia.cli.main with the documented flags and assert on the exit code, stderr and whether the voice session started, not just on internal calls. Three failure types are covered: a document that didn't index, the missing extra, and the embedder being down.
  • The change is scoped tightly: explicit enable_rag() keeps its boolean contract, a test pins that, and the docs say so.
  • It follows Fail Loudly: the error says what failed, what to do, and where to read more.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 7, 2026
Merged via the queue into amd:main with commit 22c11f7 Nov 7, 2026
41 checks passed
@kovtcharov-amd kovtcharov-amd mentioned this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes talk Talk agent changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gaia talk --index silently skips indexing after the guide's own install step, because the [talk] extra ships no RAG dependencies

2 participants