fix: keep API v1 router loading when google-genai is absent - #989
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔍 PR Validation |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
Agent Completion Truth Gate: BLOCKEDReasons: Machine-readable verdict{
"details": {
"invalid_fields": [
"issue.number",
"policy.agent_login",
"policy.run_id"
]
},
"reasons": [
"invalid_payload"
],
"verdict": "blocked"
} |
There was a problem hiding this comment.
Pull request overview
Attempts to keep optional Gemini SDK absence from breaking imports and documents the canonical backend launch command.
Changes:
- Defers the optional Gemini type annotation and adds an import regression test.
- Corrects backend startup documentation.
- Removes and ignores stale scratch artifacts.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/agents/gemini_video_master_agent.py |
Binds missing SDK symbols and defers annotation evaluation. |
tests/unit/test_optional_gemini_import.py |
Adds missing-SDK import coverage. |
CLAUDE.md |
Corrects backend launch command. |
GEMINI.md |
Corrects backend launch command. |
CONTRIBUTING.md |
Corrects contributor startup instructions. |
LAUNCH_CHECKLIST.md |
Corrects launch verification command. |
docs/TECH_STACK.md |
Corrects backend development command. |
.gitignore |
Ignores root scratch and verification artifacts. |
.verification-gate-pass |
Removes stale verification marker. |
.jules/palette.md |
Reorders and corrects an accessibility note. |
test_script.py |
Removes an ad-hoc inspection script. |
test_import.py |
Removes an ad-hoc import probe. |
test_direct_import.py |
Removes an ad-hoc import probe. |
rewrite.py |
Removes a one-off rewrite helper. |
commit_script.sh |
Removes a one-off commit helper. |
756.diff |
Removes a stale patch dump. |
749.diff |
Removes a stale patch dump. |
746.diff |
Removes a stale patch dump. |
745.diff |
Removes a stale patch dump. |
725.diff |
Removes a stale patch dump. |
723.diff |
Removes a stale patch dump. |
722.diff |
Removes a stale patch dump. |
720.diff |
Removes a stale patch dump. |
711.diff |
Removes a stale patch dump. |
710.diff |
Removes a stale patch dump. |
701.diff |
Removes a stale patch dump. |
| for module in [m for m in sys.modules if m.startswith("google")]: | ||
| del sys.modules[module] | ||
|
|
||
| from agents import gemini_video_master_agent as master |
Post-merge controller reconciliation — 2026-07-25This externally merged unit cannot be credited as complete #898 execution.
Production deployment is READY on merge commit Execution receipt:
Human authority is required to choose an explicit revert or authorize one focused post-merge remediation unit. No controller merge, revert, branch deletion, workflow approval, credential change, ruleset weakening, or manual production mutation occurred. |
Outcome
Deployments without the optional
google-genaiSDK installed no longer silently lose the entire API v1 router (/api/v1/transcript-action, health, event routes). The failure was invisible:main.pyincludes routers inside broadtry/except, so aNameErrorraised while executing the class body of a transitively imported module was logged and swallowed.Root cause — the optional import left
genai/typesunbound, and a class-body annotation was evaluated at import time:Scope
src/agents/gemini_video_master_agent.py— bindgenai = types = Nonein theexceptbranch; quote thetypes.GenerateContentConfigannotation so it is not evaluated at import.tests/unit/test_optional_gemini_import.py— subprocess regression guard that imports the module withgoogle.genaiblocked and assertsGEMINI_AVAILABLE is False,genai is None,types is None. Lives intests/unit/, the CI-gated suite.PYTHONPATH=src uvicorn youtube_extension.main:appis the only correct run form (thesrc.youtube_extension.mainform loads a second, router-less copy of the package). Updated inCLAUDE.md,GEMINI.md,CONTRIBUTING.md,LAUNCH_CHECKLIST.md,docs/TECH_STACK.md..verification-gate-passmarker and gitignored it.try/exceptaround router includes inmain.py./readyzalready returns 503 when_API_V1_ROUTER_LOADEDis false, so the failure is externally observable; changing startup semantics is a separate change.Risk
GEMINI_AVAILABLE.Verification
pytest tests/unit/test_optional_gemini_import.py: passes with the fix; fails withNameError: name 'types' is not definedwhen the source change is reverted, confirming the guard is load-bearing.Production evidence
Not applicable — no deployed surface changes. The observable effect is that
/readyzstays green on hosts lackinggoogle-genai; verifiable post-merge on the Cloud Run backend (api.uvai.io).Agent handoff