Skip to content

Review swarm: 7 fixes from 2-day merged-PR review - #9600

Merged
Git-on-my-level merged 10 commits into
mainfrom
review-swarm-2026-07-13
Jul 13, 2026
Merged

Git-on-my-level merged 10 commits into
mainfrom
review-swarm-2026-07-13

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

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-aware created_at sort sentinel — get_chat_files_desc (>30 file_ids merge path) used naive datetime.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 four datetime.min sort sentinels in backend/ are now tz-aware.
  • fix(agent-control): derive consent for request_permission in PTT/voice mode — both voice paths never built a PermissionRequestAuthorization, so the consent gate always silently denied request_permission while 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_code lowercased input before checking the mixed-case NLLB_TO_BCP47 keys, making the native-code passthrough dead. README documents eng_Latn as 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 existing nllb_active_requests gauge (requestsPerPod: 4 in 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): propagate t5838_aad_init failure from mic_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 nonzero mic_start return via error_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 manifest exempt: list.

Desktop changelog

Fragments added for the two user-visible desktop fixes (PTT permission consent, suggested-tasks ordering).

Product invariants affected

  • INV-CHAT-1

Verification

  • Each fix reviewed hunk-by-hunk by a dedicated reviewer; the chat.py fix was cross-confirmed by two reviewers (sync/memory found it, API owner fixed it).
  • Pre-push manifest checks pass (check-manifest-contract, diff-hygiene, architecture-guardrails, product-invariants with this citation, desktop-changelog-entry, brand-ui INV-UI-1, backend-import-purity, backend-async-blockers).
  • No new tests added in this PR; the underlying behavior is covered by the existing suite for each touched area. The tz-sentinel and consent fixes are the kind of regression a follow-up test should pin (noted below).

Notes / follow-ups

  • The NLLB HPA active-requests metric requires the documented prometheus-adapter helm upgrade (same manual step parakeet needs) before it takes effect in-cluster.
  • Reported-but-not-fixed concerns from the review (out of scope here): NLLB model re-downloaded every pod restart (emptyDir), gateway 13-label metrics cardinality monitoring, a static guard to prevent recurrence of the naive-datetime.min sort class.

🤖 Generated with Claude Code

Review in cubic

… — 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).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

@cursor fix CI

@cursor

cursor Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Fixed the Desktop Swift CI failure.

Root cause: SuggestedTasksStoreTests.testLoadProjectsOnlyPendingCandidatesWithoutManagedNounLeak failed because the review-swarm commit re-added a client-side string sort on createdAt:

.sorted { $0.createdAt > $1.createdAt }

That reordered ["pending", "proposal"] to ["proposal", "pending"] (proposal is chronologically newer). The test suite treats backend return order as authoritative — see testLoadPreservesAuthoritativeBackendOrderAcrossMixedTimestampFormats, which also guards against lexicographic string-sort bugs with mixed ISO formats (Z vs +00:00).

Fix (commit daad09098):

  • Removed the client-side sort from SuggestedTasksStore.load()
  • Deleted the 20260713-suggested-tasks-order.json changelog fragment (no longer a user-visible change)

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 review-swarm-2026-07-13 — Desktop Swift Build & Tests should pass on the next CI run.

Open in Web Open in Cursor 

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]>
@Git-on-my-level
Git-on-my-level merged commit ba0d8fb into main Jul 13, 2026
24 checks passed
@Git-on-my-level
Git-on-my-level deleted the review-swarm-2026-07-13 branch July 13, 2026 04:13
Git-on-my-level added a commit that referenced this pull request Jul 16, 2026
## 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
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
…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
Wizard815 pushed a commit to Wizard815/omi-local that referenced this pull request Nov 25, 2026
…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
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.

2 participants