Repository navigation
Review swarm: 7 fixes from 2-day merged-PR review - #9600
Conversation
…ifest — review swarm
…rmission — review swarm
… — review swarm get_chat_files_desc (the >30 file_ids chunking path) sorted merged results with datetime.min as the missing-key fallback. A file doc lacking created_at then paired a NAIVE datetime against the TZ-AWARE Firestore datetimes of its siblings during sort, raising TypeError: can't compare offset-naive and offset-aware datetimes -> HTTP 500. Same failure class #9571 closed for the review queue. datetime.min.replace(tzinfo=timezone.utc) is comparable and sorts oldest, so a doc missing created_at sinks to the bottom of the descending sort instead of crashing it. timezone is already imported.
…ew swarm t5838_aad_init() powers the 1.8V mic rail; if it fails the PDM mic is unpowered and captures silence, but mic_start() only logged and returned 0 (false-ready at the caller level). main() already handles a nonzero mic_start return via error_microphone(), so propagate the failure — the device reports a mic fault instead of booting into a silent-capture state. Closes the false-ready class #9048 targeted at the caller level; aad_hw_start() remains non-fatal (mic already running by then).
…es — review swarm PR #9591 removed the client-side .sorted { createdAt > } from SuggestedTasksStore.load(), leaving the top-5 slice dependent on the backend return order with no test asserting that order. Re-add the sort as defense-in-depth so a backend ranking regression can't silently show stale candidates. ISO8601 createdAt strings sort correctly lexicographically.
…swarm The NLLB GPU inference HPA scaled only on CPU (70%), but CPU stays low during GPU inference so it never scaled past minReplicas (maxReplicas=2 unreachable). Add a concurrency-based External metric on the existing nllb_active_requests gauge (requestsPerPod: 4 in prod), mirroring the parakeet active-requests pattern. Wires the nllb_active_requests_total rule into the cluster-wide prometheus-adapter (dev+prod) so the HPA metric resolves. CPU is retained as a secondary floor. Deploy requires the documented prometheus-adapter helm upgrade (same manual step parakeet needs).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7e52cdbc8
ℹ️ 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".
| // Defense-in-depth: sort newest-first by createdAt so the top-N slice is | ||
| // deterministic regardless of the API return order (backend ranks server-side, | ||
| // but a regression there must not silently show stale candidates). | ||
| .sorted { $0.createdAt > $1.createdAt } |
There was a problem hiding this comment.
Parse timestamps before sorting suggested tasks
When candidate timestamps are valid but not byte-comparable, this client-side string sort can override the backend's newest-first order and push a newer candidate out of the top five. For example, a backend response containing mixed ISO forms such as 2026-07-09T12:00:00Z and 2026-07-09T12:00:00.500+00:00 is chronologically ordered with the fractional value second later, but lexicographic descending ranks the Z string first. Parse createdAt to Date (with a fallback) or preserve the authoritative backend order instead of comparing raw strings.
Useful? React with 👍 / 👎.
|
@cursor fix CI |
|
Fixed the Desktop Swift CI failure. Root cause: .sorted { $0.createdAt > $1.createdAt }That reordered Fix (commit
The backend already ranks candidates server-side; behavioral tests cover ordering. The Codex P2 note about parsing timestamps before sorting is moot once we stop re-sorting on the client. Pushed to |
The defensive string sort re-added in review-swarm broke SuggestedTasksStoreTests.testLoadProjectsOnlyPendingCandidatesWithoutManagedNounLeak and conflicts with testLoadPreservesAuthoritativeBackendOrderAcrossMixedTimestampFormats, which locks backend return order as authoritative (including mixed ISO timestamp forms). Revert the client-side sort; the backend ranks candidates server-side and the suite already guards ordering via behavioral tests. Co-authored-by: David Zhang <[email protected]>
## Summary\n\n- add a semantic, JSON failure-class registry plus an offline scripts/failure-class CLI for agent-oriented preparation, explanation, validation, and advisory reporting\n- surface the same failure-class guidance with product-invariant suggestions through scripts/pr-preflight --suggest, before a PR exists\n- keep PR-body checks in local/PR preflight while excluding them from metadata-less post-merge main pushes\n- enforce PR-body declarations for reactive fix: commits through the existing preflight manifest, while distinguishing proactive harden: work\n- add manifest-backed recurrence ratchets for naive Python datetime sort sentinels and unsafe macOS Swift dictionary construction\n- replace repetitive existing-class narratives with a validated declaration, require real-incident citations for new guards, and defer locked invariants until seven stable days\n- extract the X connector transport and DTOs from APIClient.swift into its connector feature, reducing the client from 6,502 to 6,430 lines without changing endpoint behavior\n\nCloses #9822\n\n## Failure class (fixes)\n\nFailure-Class: none\n\n## New guards\n\nThe datetime ratchet cites #9571 and #9600; the desktop dictionary ratchet cites #6506 and #9288. These are static checks because the canonical safe primitives already exist, while the prohibited patterns can be reintroduced independently at multiple call sites.\n\n## Product invariants affected\n\n- INV-AUTH-1 — the authenticated transport implementation is unchanged; this moves its X connector extension only.\n- INV-INT-1 — the X connector endpoints and DTOs are now co-located with their connector-import feature; behavior is unchanged.\n\n## Verification\n\n- python3 scripts/test_failure_class.py — 13 passed\n- python3 .github/scripts/test_pr_preflight.py — 10 passed\n- python3 .github/scripts/test_run_checks.py — 13 passed\n- focused backend ratchet tests — 6 passed\n- BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-backend-unit-failures.txt bash backend/test.sh — 9 passed\n- bash backend/test.sh — 631-file CI-equivalent suite passed\n- xcrun swift test --package-path Desktop --filter ConnectorImportOperationsTests — 13 passed\n- xcrun swift build -c debug --package-path Desktop — passed\n- python3 desktop/macos/scripts/check_desktop_test_quality.py — passed\n- desktop-core-harness self-check — passed with the repository virtualenv and Node 22 runtime\n- scripts/pr-preflight — passed (26 checks)\n- make preflight — passed\n\n
…ware#9841) ## Summary\n\n- add a semantic, JSON failure-class registry plus an offline scripts/failure-class CLI for agent-oriented preparation, explanation, validation, and advisory reporting\n- surface the same failure-class guidance with product-invariant suggestions through scripts/pr-preflight --suggest, before a PR exists\n- keep PR-body checks in local/PR preflight while excluding them from metadata-less post-merge main pushes\n- enforce PR-body declarations for reactive fix: commits through the existing preflight manifest, while distinguishing proactive harden: work\n- add manifest-backed recurrence ratchets for naive Python datetime sort sentinels and unsafe macOS Swift dictionary construction\n- replace repetitive existing-class narratives with a validated declaration, require real-incident citations for new guards, and defer locked invariants until seven stable days\n- extract the X connector transport and DTOs from APIClient.swift into its connector feature, reducing the client from 6,502 to 6,430 lines without changing endpoint behavior\n\nCloses BasedHardware#9822\n\n## Failure class (fixes)\n\nFailure-Class: none\n\n## New guards\n\nThe datetime ratchet cites BasedHardware#9571 and BasedHardware#9600; the desktop dictionary ratchet cites BasedHardware#6506 and BasedHardware#9288. These are static checks because the canonical safe primitives already exist, while the prohibited patterns can be reintroduced independently at multiple call sites.\n\n## Product invariants affected\n\n- INV-AUTH-1 — the authenticated transport implementation is unchanged; this moves its X connector extension only.\n- INV-INT-1 — the X connector endpoints and DTOs are now co-located with their connector-import feature; behavior is unchanged.\n\n## Verification\n\n- python3 scripts/test_failure_class.py — 13 passed\n- python3 .github/scripts/test_pr_preflight.py — 10 passed\n- python3 .github/scripts/test_run_checks.py — 13 passed\n- focused backend ratchet tests — 6 passed\n- BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-backend-unit-failures.txt bash backend/test.sh — 9 passed\n- bash backend/test.sh — 631-file CI-equivalent suite passed\n- xcrun swift test --package-path Desktop --filter ConnectorImportOperationsTests — 13 passed\n- xcrun swift build -c debug --package-path Desktop — passed\n- python3 desktop/macos/scripts/check_desktop_test_quality.py — passed\n- desktop-core-harness self-check — passed with the repository virtualenv and Node 22 runtime\n- scripts/pr-preflight — passed (26 checks)\n- make preflight — passed\n\n
…aterial render_material sorted undated conversations with a naive datetime.min. The (started_at is None, ...) tuple key already kept it from being compared with aware timestamps, so nothing broke, but the backend-datetime-sort-sentinel-ratchet (BasedHardware#9571/BasedHardware#9600) rejects new naive sentinels; use datetime.min.replace(tzinfo=timezone.utc). Adds a test pinning the ordering this key exists for: undated conversations come after dated ones, in their original order. It passes on both the old and new key; it guards the behavior, not a past bug. Verification: BACKEND_UNIT_TEST_FILE_LIST=<test_day_review_rules.py, test_day_review_service.py> backend/test.sh -> 7 passed, 7 passed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0148HLrpWR8Mimn43rkNvGKg


Summary
Review-swarm findings from a 10-agent code review of the last 2 days of merged PRs (62 PRs / 1072 files). Seven isolated bugs were found and fixed; no behavior change beyond the fixes. Each commit is independent and reviewable on its own.
High-severity correctness
fix(chat): tz-awarecreated_atsort sentinel —get_chat_files_desc(>30 file_ids merge path) used naivedatetime.min, which TypeError-compares against tz-aware Firestore dates and 500s. Last instance of the fix(memory): use a tz-aware sentinel in the review-queue sort key to avoid a 500 #9571 failure class; all fourdatetime.minsort sentinels inbackend/are now tz-aware.fix(agent-control): derive consent forrequest_permissionin PTT/voice mode — both voice paths never built aPermissionRequestAuthorization, so the consent gate always silently deniedrequest_permissionwhile the system prompt told the model to call it. The feature was non-functional in voice mode. Fixed by deriving authorization from the spoken turn transcript (mirrors the text path; fail-closed).Medium
fix(translation): NLLB native-language-code case resolution —_resolve_nllb_codelowercased input before checking the mixed-caseNLLB_TO_BCP47keys, making the native-code passthrough dead. README documentseng_Latnas valid input.fix(nllb): autoscale on active requests instead of CPU-only — the NLLB GPU HPA scaled only on CPU, which stays low during GPU inference, so it never scaled past minReplicas. Added a concurrency-based External metric on the existingnllb_active_requestsgauge (requestsPerPod: 4in prod), mirroring the parakeet pattern, and wired the adapter rule into the cluster-wide prometheus-adapter (dev+prod). CPU retained as a secondary floor.fix(firmware): propagatet5838_aad_initfailure frommic_start— the init powers the 1.8V mic rail; on failure it only logged and returned 0 (false-ready at the caller: mic "starts" but captures silence).main()already handles a nonzeromic_startreturn viaerror_microphone(), so propagate the failure. Closes the feat: support Hardware AAD feature and improve power consumption #9048 false-ready goal at the caller level.Low / defense-in-depth
fix(tasks): re-add defensive newest-first sort for suggested candidates — Improve Smart Tasks signal quality and isolation #9591 removed the client-side sort, leaving the top-5 slice dependent on backend return order with no test. Re-added the sort as defense-in-depth.fix(ci): drop duplicate isinstance-ratchet exempt entry — two commits registered the same script in the manifestexempt:list.Desktop changelog
Fragments added for the two user-visible desktop fixes (PTT permission consent, suggested-tasks ordering).
Product invariants affected
Verification
Notes / follow-ups
datetime.minsort class.🤖 Generated with Claude Code