Onboarding personalization, chat cold-start fix, Lexi chat UX, and backend hardening - #392
Merged
Merged
Conversation
…and chat UX improvements Three workstreams from this session, all verified via independent code review and full test suites (backend, ai-service, Flutter): Onboarding personalization - Persist goal/interest collected at onboarding (previously silently dropped before reaching the backend) on User, thread through to ai-service's learner_profile via the existing /internal/learner-state/batch-get pull and LearnerStateProfile.state_epoch cache-invalidation mechanism — no new invalidation plumbing needed. - Fix version-drift between cache_utils.py's hard-gate schema version and dependencies.py's certificate system; add content-hash-based KG mutation detection (kg_service_v3.py). Cold-start latency fix (ai-service) - RetrievalServiceV3 (graph analytics + concept embeddings) and the JIT GLiNER model were built lazily on whichever live request hit them first — measured at 169.5-478s on the real production KG. Now warmed as a background task at boot (non-blocking, so Docker's HEALTHCHECK start-period isn't at risk), with locking so a racing live request awaits the same in-flight build instead of duplicating it. - Cap betweenness-centrality sampling and skip community detection above a node-count ceiling to keep graph_analytics.py bounded on the real KG size. - Fix diagnose_node's Groq-fallback path (an exception from the local gateway used to skip the fallback entirely) and its too-small max_tokens causing truncated JSON. Lexi chat UX - TTS now defaults to the app-wide Sound setting until the user explicitly overrides it in-chat. - Grammar/vocabulary corrections highlight inline on the user's own message bubble (which contains the literal wrong text) instead of only being visible in a separate "View notes" sheet. - After a correction, Lexi can offer a one-tap practice follow-up tied to the specific concept the mistake traced to (not a generic weak-spot scan). - Fixed a real data-loss bug: UserVocabularyModel silently dropped the word text the backend already sent, so "already saved" state in News/YouTube/Book reader always reset after an app restart. - A new session can reference what the learner talked about last time via a short recap pulled into the system prompt. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ardening - Only invalidate the wallet cache when a WalletCRUD transaction actually commits (commit=True) — previously it invalidated on every call even when the caller owned the outer transaction and could still roll it back, leaving a stale cache miss race. Callers using commit=False are responsible for invalidating after their own commit. - claim_daily_reward now also invalidates the wallet cache (gems are awarded there but the cache was never busted). - Lock the streak row (with_for_update) before a read-modify-write update to close a concurrent-update race window. - safe_http.resolve_pinned_ip: is_global alone still admits multicast ranges (224.0.0.0/4, ff00::/8) as a "public" address — DNS-rebinding hardening gap. Now excludes them explicitly. - Add scheduled Celery tasks (content_prefetch_schedule.py) for periodic news/YouTube/podcast content prefetch, wired into celery_app's beat schedule. - Add test coverage for the PDF-based vocabulary/course bulk-import endpoints (admin_courses._extract_pdf_text and its two routes). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
|
❌ PR-Agent failed to apply 'local' repo settings The configuration file needs to be a valid TOML, please fix it. Error message: Configuration content:[config]
# Use Google Gemini API
model = "google/gemini-2.5-pro"
fallback_models = ["google/gemini-2.5-flash"]
[pr_reviewer]
# Enable/disable features
require_focused_review = true
require_score_review = true
require_tests_review = true
require_security_review = true
require_estimate_effort_to_review = true
# Review settings
num_code_suggestions = 5
inline_code_comments = true
auto_review = true
remove_previous_review_comment = true
# Language and tone
extra_instructions = """
- Focus on code quality, security, and best practices
- Check for proper error handling
- Verify Clean Architecture principles
- Ensure proper test coverage
- Review API design and RESTful conventions
- Check for potential performance issues
- Verify proper logging and monitoring
"""
[pr_code_suggestions]
# Code improvement suggestions
num_code_suggestions = 5
extra_instructions = """
- Suggest improvements for code readability
- Recommend better naming conventions
- Propose performance optimizations
- Suggest security enhancements
"""
[pr_description]
# Auto-generate PR description
publish_description = true
add_original_user_description = true
extra_instructions = """
- Summarize main changes
- List affected components
- Note breaking changes
- Include testing notes
"""
[pr_questions]
# Auto-generate clarifying questions
num_questions = 3
extra_instructions = """
- Ask about design decisions
- Question potential edge cases
- Clarify implementation choices
"""
[config]
# Model configuration (uncomment to customize)
# model = "gpt-4-turbo-preview"
# model = "anthropic/claude-3-5-sonnet-20241022"
# fallback_models = ["gpt-3.5-turbo"]
# Git provider
git_provider = "github"
# Review triggers
pr_commands = [
"/review",
"/describe",
"/improve",
"/ask",
"/update_changelog",
]
|
.pr_agent.toml had git_provider/pr_commands as bare keys after the last
named table ([pr_questions]) — in TOML those get attributed to whatever
section preceded them, not the root. PR-Agent's config loader then failed
to merge them back into [config] ("Cannot declare ('config',) twice"),
breaking PR-Agent on every PR. Moved both into [config] where they belong.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two commits on top of the already-merged product-expansion work (#391):
7e152307— feat(lexi-chat): onboarding personalization, cold-start latency fix, and chat UX improvementsgoal/interest(previously silently dropped) and thread into ai-service'slearner_profilevia the existing internal batch-get pull +LearnerStateProfile.state_epochcache-invalidation.RetrievalServiceV3(graph analytics + concept embeddings) and the JIT GLiNER model now warm as a non-blocking background task at boot instead of on whichever live request hits them first.diagnose_node's broken Groq-fallback path and truncated-JSONmax_tokens.cf90bdab— fix(backend): wallet cache consistency, streak race condition, SSRF hardeningclaim_daily_rewardnow also invalidates the wallet cache.safe_http.resolve_pinned_ip: excludes multicast ranges thatis_globalalone let through (DNS-rebinding hardening gap).Both commits were independently code-reviewed (3 separate reviews covering ai-service/backend-service/flutter-app) and every finding was fixed before commit.
Test plan
pytestsuite (1363 passed, excluding the real-Postgres-only integration file which was run separately and passed)pytest tests/trace_cag/+ related chat integration suites (404 passed)flutter testacross lexi_chat/vocabulary/youtube/books/core-services (175 passed)dart analyze/ backend lint clean (only one pre-existing, unrelated info-level lint remains)🤖 Generated with Claude Code