Repository navigation
Fix retrieval and output semantic correctness - #8366
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cb349ca76
ℹ️ 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".
There was a problem hiding this comment.
5 issues found across 14 files
Confidence score: 3/5
- In
backend/models/daily_summary_payload.py, usinglist[dict]for LLM output means key typos can pass validation and silently produce empty/default fields, which risks shipping incorrect summaries without obvious failures — add stricter schema validation (typed models/required keys) before merging. backend/tests/unit/test_retrieval_semantics.pyintroduces regression coverage, but if the test runner script does not include this module, CI can report green while these checks never run and regressions slip through — wire this test into the backend test runner before merging.- In
backend/utils/llm/external_integrations.py, logging raw exceptions may expose user/LLM content in logs, creating avoidable privacy and compliance risk — replace interpolated exception logging with static or sanitized messages before merge. backend/models/conversation_metadata.pyhas unused key constants and an unusednormalize_metadata_valueshelper, which adds confusion around the true metadata contract and increases maintenance risk — clean these up now or immediately in a follow-up to keep keys single-sourced.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Git-on-my-level
left a comment
There was a problem hiding this comment.
Addressed the unresolved review feedback.
Changes:
- Added
tests/unit/test_retrieval_semantics.pytobackend/test.shso CI's source-of-truth backend runner executes the new regression tests. - Replaced raw
dictdaily-summary section payloads with typed Pydantic item models; malformed keys such astopic_namenow fail validation instead of silently defaulting. - Sanitized daily-summary parse error logging before emission.
- Removed unused conversation metadata dead code/constants flagged by Cubic.
Verification:
ENCRYPTION_SECRET=*** VIRTUAL_ENV= uv run pytest tests/unit/test_retrieval_semantics.py -q→17 passedpython3 -m py_compile models/daily_summary_payload.py models/conversation_metadata.py utils/llm/external_integrations.py→ passed
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f94adce83
ℹ️ 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".
Git-on-my-level
left a comment
There was a problem hiding this comment.
Addressed the validation-error logging finding.
Changes:
- Added
sanitize_validation_error()to log only structural Pydantic error details (type,loc,msg) withinclude_input=False. - Split the daily-summary fallback handler so JSON decode errors still log sanitized decoder details, while schema validation errors no longer stringify the full
ValidationError/input_value. - Added regression coverage proving private summary text and
input_valueare absent from the validation log summary while the field path remains available for debugging.
Verification:
ENCRYPTION_SECRET=*** VIRTUAL_ENV= uv run pytest tests/unit/test_retrieval_semantics.py -q→18 passed in 0.11sgit diff --check→ clean
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Supersedes #8290, #8291, #8306, #8310, #8311, #8313, #8319, #8320.
Original issue discovery, reproductions, and candidate fixes by @ZachL111.
This aggregates the retrieval/output semantic correctness fixes into one focused backend PR:
build_conversation_context(...) -> str | Nonepath so short conversations are included consistentlyapp_idto prevent passing anAppobject as the cache keyIncluded Zach PRs
Included/redesigned in this aggregate: #8290, #8291, #8306, #8310, #8311, #8313, #8319, #8320.
Deferred from this aggregate: none.
Tests
cd backend && ./scripts/sync-python-deps.shcd backend && source .venv/bin/activate && pytest tests/unit/test_retrieval_semantics.py tests/unit/test_daily_summary_regenerate.py tests/unit/test_daily_summary_race_condition.py tests/unit/test_conversations_to_string.pycd backend && source .venv/bin/activate && python -m py_compile models/conversation_metadata.py models/calendar_mutation.py models/daily_summary_payload.py utils/conversations/datetime_utils.py utils/conversations/merge_conversations.py utils/retrieval/rag.py utils/llm/chat.py utils/llm/external_integrations.py utils/retrieval/tools/calendar_tools.py database/mem_db.py database/redis_db.py database/vector_db.py tests/unit/test_retrieval_semantics.pycd backend && bash testing/e2e/run.sh— 73 passed, 6 skippedAlso ran
python backend/scripts/scan_async_blockers.pyfrom repo root; it exits 0 and reports existing async-blocker findings unrelated to this PR. Running it frombackend/currently fails withError: backend/routers not found, so root invocation was used.