Repository navigation
fix(notes): v2 notes ask for an emoji instead of storing the 🧠 default - #23389
Conversation
The v2 contract, submit schema, and field description never asked for an emoji, so the pydantic default was stored on every served conversation. Restore the legacy ask on all three surfaces and map a missing or blank emoji to the category's emoji before it reaches Structured. Ship a dry-run-by-default backfill script for affected rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12bd5028dd
ℹ️ 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".
| data = ref.get(transaction=transaction).to_dict() or {} | ||
| if candidate_emoji(data) is None: | ||
| return False | ||
| transaction.update(ref, {'structured.emoji': emoji}) |
There was a problem hiding this comment.
Revalidate the row before writing the backfill
When --apply overlaps a reprocess that leaves emoji == '🧠' but changes the category—for example, while old notes-v2 workers are still draining during rollout—the transaction retries against the latest document, but candidate_emoji(data) is used only as a boolean and the pre-transaction emoji is still written. A row changed from work to health can therefore receive 🧑💻 instead of 🩺; similarly, deletion or discard after the page read is never rechecked. Recompute the replacement and visibility from the transactional snapshot before updating.
Useful? React with 👍 / 👎.
| created_at = created_at_utc(conversation.get('created_at')) | ||
| if created_at is None or created_at < since: | ||
| outcomes['skipped_before_since'] += 1 |
There was a problem hiding this comment.
Include reprocessed older conversations in the backfill
When a user reprocessed an existing conversation during the affected rollout, the notes-v2 path replaced its structured output while retaining the conversation's original created_at. This cutoff therefore skips every affected conversation originally created before --since, even though its default 🧠 was generated after the rollout, leaving those rows unrepaired. Candidate selection needs to use notes-generation/update provenance or otherwise include older conversations reprocessed during the affected interval rather than filtering on creation time.
Useful? React with 👍 / 👎.
…c and legacy paths (#23512) * fix(notes): stop persisting the 🧠 unset emoji default on deterministic and legacy paths #23389 repaired the v2 NotesOutput boundary, but every other writer that never received an emoji still persisted the Structured schema default 🧠: the sync-intake deterministic minimum, the short-clip quiet minimum (emoji=''), the media minimum, and the legacy StructuredExtraction / AgentNotesSubmission submissions. A stored default is indistinguishable from a chosen one, so users saw a deliberate brain badge no code chose. - Move the category fallback (DEFAULT_EMOJI/CATEGORY_EMOJI/fallback_emoji) to models/conversation_emoji.py and map category `other` to the neutral 💬, so every CategoryEnum member resolves to a non-brain emoji. - Deterministic/minimum builders set the category fallback explicitly; quiet_minimum no longer blanks the emoji (blank renders as the client's random pick, which includes 🧠). - StructuredExtraction/RichStructuredExtraction.to_structured apply the fallback, covering AgentNotesSubmission and EpisodeStructuredExtraction. - The Structured model's own default (SDK + backend mirror), the share projection, and the client display projection change 🧠 → 💬, so a forgotten field lands on the neutral emoji. The deliberate relevance-discard placeholder (🧠/🎉 on discarded rows) is untouched. - The app decodes a missing or blank emoji as 💬 and renders an empty emoji deterministically instead of a random pick containing 🧠; the app-client OpenAPI spec and generated dart wire schemas are regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(retrieval): unblock the pyright lane and the isolation fallback #23433 left red #23433 merged with all six backend unit shards failing, and every later main push has failed the same way, so no PR can go green. This carries the minimal repair; revert if the owning change lands its own fix. - The defensive None/junk guards in result_bounds and omi_tools trip pyright's reportUnnecessary* rules. Keep the runtime hardening exactly as merged and suppress per-line with the codebase's established "# type: ignore[...] # defensive" idiom, as memories.py already does. - generate_2025's seg.end None filter gets the same treatment instead of trusting the required-float annotation. - The spec_from_file_location fallbacks did not register the module in sys.modules before exec, so model_text's dataclasses crashed with AttributeError under test_omi_tools_resilience's stub_modules harness (the test never ran in CI: the shards died at pyright first). Register before exec, matching the load_module_fresh recipe. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(payment): allowlist #23416's declined-proration cases against the CPU guard test_payment_declined_proration lands 1.25-1.66s CPU per test on CI runners (the subscription/Stripe module graph amortizes into the calls under file isolation). The file never ran on main: every shard died at the #23433 pyright errors first, so the guard had not flagged it. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
The notes v2 serve path never asked the model for an emoji: the v2
NotesOutputschema carried
emoji: str = '🧠'with no field description, the v2 OUTPUT ruleswere silent about it, and the agentic submit schema offered a bare string. The
model omitted the field and the pydantic default 🧠 was stored on every real
conversation served by the v2 contract since the 2026-10-22 rollout
(
fec589081a7,be976302985, train5c1dec0). The legacy path always carriedthe ask — the legacy structured model's format instructions say
"An emoji to represent the conversation" — and the hand-mirrored v2 schema
dropped it in silence: no decode error, no failing test, because the mirror was
internally consistent.
Fix
Ask on every v2 path.
NotesOutput.emojiregains the legacy wording(
Field(description='An emoji to represent the conversation', default=🧠)), theagentic instructions require "exactly one emoji that represents the
conversation", the hand-written
SUBMIT_SCHEMAemoji entry carries the samedescription, and the v2 OUTPUT contract rules add the ask
(
backend/utils/llm/notes_output.py,notes_agent_prompt.py,notes_output_contract.py).Fail safe when none arrives. A missing, blank, or defaulted emoji no longer
stores 🧠 for a real conversation:
to_structured()maps the conversation'scategory to a deterministic emoji (work → 🧑💻, education → 📚, …; all 31
non-
othercategories covered). 🧠 survives only when the category has nomapping (
other). The default value itself is the missing-emoji signal becauseagentic submissions are round-tripped through
model_dump, which erasesfields_set.Backfill tool, dry-run by default.
backend/scripts/backfill_notes_v2_default_emoji.pyfinds one owner'sconversations with
structured.emoji == '🧠', not discarded, created at/after aUTC time, and rewrites only
structured.emojiwith the same category fallbackthrough a transaction that re-checks the stored emoji. The uid is read from a
file (
--uid-file), never argv. It has not been run against any environment;whether and where to run it is the rollout lead's decision.
Dry run:
python scripts/backfill_notes_v2_default_emoji.py --uid-file /path/uid.txt --since 2026-10-22T00:00:00ZFailure-Class: FC-mirrored-model-omits-new-member
Product invariants affected
None. No registered invariant's path globs cover the notes pipeline; the change
keeps notes grounded per-field (a missing emoji never invents content — it maps
from the conversation's own category) and touches no wire contract.
Test evidence
New regression tests in
backend/tests/unit/test_notes_packet_v2.py:test_every_v2_path_asks_for_an_emoji— one-shot parser format instructions,agentic submit tool, contract-mount schema, OUTPUT rules, and instructions all
carry the emoji ask.
test_a_submission_without_a_usable_emoji_never_stores_the_default— missing,blank, and
model_dump-round-tripped emojis store the category emoji; anexplicit choice is preserved;
otherkeeps 🧠.test_served_one_shot_output_without_an_emoji_uses_the_category_fallback— theserve path end-to-end with a model response that omits emoji stores the
category emoji, not 🧠.
Focused suites (one pytest per file, repo runner):
200 passed, 0 failed (60 in
test_notes_packet_v2.pyincluding the three newtests; 33
test_notes_agent.py; 33test_agent_tool_rules.py; 69test_conversation_notes_v2.py; 13test_structured_salience.py; 25test_wave2_action_items.py).🤖 Generated with Claude Code