Skip to content

fix(notes): v2 notes ask for an emoji instead of storing the 🧠 default - #23389

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/notes-v2-emoji
Oct 23, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/notes-v2-emoji

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

The notes v2 serve path never asked the model for an emoji: the v2 NotesOutput
schema carried emoji: str = '🧠' with no field description, the v2 OUTPUT rules
were 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, train 5c1dec0). The legacy path always carried
the 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.emoji regains the legacy wording
    (Field(description='An emoji to represent the conversation', default=🧠)), the
    agentic instructions require "exactly one emoji that represents the
    conversation", the hand-written SUBMIT_SCHEMA emoji entry carries the same
    description, 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's
    category to a deterministic emoji (work → 🧑‍💻, education → 📚, …; all 31
    non-other categories covered). 🧠 survives only when the category has no
    mapping (other). The default value itself is the missing-emoji signal because
    agentic submissions are round-tripped through model_dump, which erases
    fields_set.

  • Backfill tool, dry-run by default.
    backend/scripts/backfill_notes_v2_default_emoji.py finds one owner's
    conversations with structured.emoji == '🧠', not discarded, created at/after a
    UTC time, and rewrites only structured.emoji with the same category fallback
    through 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:00Z

Failure-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; an
    explicit choice is preserved; other keeps 🧠.
  • test_served_one_shot_output_without_an_emoji_uses_the_category_fallback — the
    serve path end-to-end with a model response that omits emoji stores the
    category emoji, not 🧠.

Focused suites (one pytest per file, repo runner):

cd backend
printf '%s\n' tests/unit/test_notes_packet_v2.py tests/unit/test_notes_agent.py \
  tests/unit/test_agent_tool_rules.py tests/unit/test_structured_salience.py \
  tests/unit/test_wave2_action_items.py tests/unit/test_conversation_notes_v2.py \
  > /tmp/emoji_focus_tests.txt
BACKEND_UNIT_TEST_FILE_LIST=/tmp/emoji_focus_tests.txt bash test.sh

200 passed, 0 failed (60 in test_notes_packet_v2.py including the three new
tests; 33 test_notes_agent.py; 33 test_agent_tool_rules.py; 69
test_conversation_notes_v2.py; 13 test_structured_salience.py; 25
test_wave2_action_items.py).

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T12:26:19.638643Z 12bd502 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.

@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: 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".

Comment on lines +86 to +89
data = ref.get(transaction=transaction).to_dict() or {}
if candidate_emoji(data) is None:
return False
transaction.update(ref, {'structured.emoji': emoji})

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

Comment on lines +132 to +134
created_at = created_at_utc(conversation.get('created_at'))
if created_at is None or created_at < since:
outcomes['skipped_before_since'] += 1

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

@Git-on-my-level
Git-on-my-level merged commit abfff9d into main Oct 23, 2026
68 of 71 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/notes-v2-emoji branch October 23, 2026 12:49
Git-on-my-level added a commit that referenced this pull request Oct 24, 2026
…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]>
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