Skip to content

fix(backend): align types with tested runtime hardening to unblock pyright gate - #23526

Closed
Git-on-my-level wants to merge 2 commits into
mainfrom
fix/backend-typecheck-align-20261024
Closed

Git-on-my-level wants to merge 2 commits into
mainfrom
fix/backend-typecheck-align-20261024

Conversation

@Git-on-my-level

Copy link
Copy Markdown
Member

Summary

Main's backend pyright gate (repo-wide, pinned 1.1.403) went red when #23433 and #23434 landed: 5 reportUnnecessary* errors where deliberate, test-covered runtime hardening contradicts narrower annotations. This aligns the annotations with the tested runtime contract so every backend push can pass the gate again. No behavior changes.

  • utils/retrieval/tools/omi_tools.py: drop the redundant isinstance(query, str) clause in get_omi_product_info_tool — query is Optional[str], the isinstance guard subsumes the None case, and every input class returns the same error string as before.
  • utils/retrieval/tools/result_bounds.py: declare what the tests assert — cap_items_for_llm(items: List[T] | None, ...) and bounded_result(result: str | None, ...) — and fold the None/non-str normalization into a single isinstance guard with identical behavior. The truncation suffix switches += to a plain f-string assignment: the file's fallback importlib import leaves truncation_note untyped, and an augmented assignment then widens the variable back to its declared Optional type at the return (latent on main, exposed by the widened annotation).
  • utils/wrapped/generate_2025.py: _compute_conversation_duration reads segment ends through an explicit Optional tract — legacy/unvalidated conversation data can carry missing end timestamps, covered by test_compute_conversation_duration_ignores_none_segment_end.

No skip hatches: no ignore comments, no config changes. Every comparison pyright proved unnecessary is now provably necessary or gone.

Failure-Class

Failure-Class: none

Testing

  • pyright -p pyrightconfig.json (pinned 1.1.403): 0 errors repo-wide; origin/main reports 5 errors.
  • Hardening suites covering the touched paths all pass: tests/unit/test_retrieval_result_bounds.py, test_omi_tools_resilience.py, test_goals_wrapped_firmware_hardening.py, test_action_item_tool_result_bound.py, test_conversation_tool_date_range_bound.py — 41 passed.

…right gate

#23433/#23434 hardened retrieval and wrapped paths with runtime checks their
annotations prove unnecessary, turning the repo-wide pyright gate (pinned
1.1.403) red for every backend push. Widen the annotations to the tested
runtime contract (Optional inputs), fold redundant guards, and read legacy
segment ends through an explicit Optional tract. No behavior changes.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T17:31:32.344392Z 7f4a266 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Git-on-my-level added a commit that referenced this pull request Oct 24, 2026
Carry the reviewed main-integration prerequisite from bfd7dfe. Main's defensive retrieval and wrapped guards currently contradict their annotations and fail the mandatory whole-backend pyright gate. Preserve runtime behavior and all guards while aligning their declared types; episode behavior and quiet replay/arming remain unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 24, 2026
)

* fix(backend): keep unplaced episode speech and quiet recovery progressing

Failure-Class: FC-high-water-cursor-skips-unready-row

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(backend): carry runtime typing alignment from #23526

Carry the reviewed main-integration prerequisite from bfd7dfe. Main's defensive retrieval and wrapped guards currently contradict their annotations and fail the mandatory whole-backend pyright gate. Preserve runtime behavior and all guards while aligning their declared types; episode behavior and quiet replay/arming remain unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(backend): carry remaining main CI prerequisites

Carry fallback module registration from 8037f2f so the real isolated retrieval suites can import dataclasses correctly. Preserve the existing test isolation and assertions. Carry the three payment CPU classifications from 39133dc; upstream CI run 40116299270 independently measured 1.37-1.73s for these subscription/Stripe cases. No global timing limit or test execution is disabled. These inherited main failures otherwise prevent exact-head CI from turning green.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Superseded: main received an equivalent typecheck alignment overnight (folded into #23418/#23512) — result_bounds.py now widens cap_items_for_llm/bounded_result the same way, and Backend Unit Tests is green on main again. Closing in favor of that; the diagnosis here (load_module_fresh dataclass sys.modules ERRORS and the timing-budget overruns were the remaining lane breakage) stays in the thread for the record.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant