Skip to content

fix(backend): remove invalid avatar access in task sync - #2190

Open
FicoHu wants to merge 2 commits into
wecode-ai:mainfrom
FicoHu:fix/websocket-user-avatar-20260724T093424Z
Open

fix(backend): remove invalid avatar access in task sync#2190
FicoHu wants to merge 2 commits into
wecode-ai:mainfrom
FicoHu:fix/websocket-user-avatar-20260724T093424Z

Conversation

@FicoHu

@FicoHu FicoHu commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • stop incremental WebSocket task sync from reading the nonexistent User.avatar ORM attribute
  • align incremental sender payloads with the existing live-message payload shape
  • add regression coverage for user-authored incremental history entries

Production evidence

The hourly production patrol found 8 task:join failures with the stable signature 'User' object has no attribute 'avatar'. The shared User ORM model defines id and user_name but no avatar column; the live WebSocket sender payload already sends only those two fields.

Tests

  • cd backend && uv run pytest tests/api/ws/test_chat_namespace_fork_history.py -q — 3 passed
  • cd backend && uv run black --check app/api/ws/chat_namespace.py tests/api/ws/test_chat_namespace_fork_history.py

Summary by CodeRabbit

  • Bug Fixes
    • Updated chat subtask data to provide user sender details without including avatar information.
    • Preserved sender information for user-generated subtasks while keeping non-user subtasks without a sender.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d676e2a3-9e03-4701-8626-24f149a251a2

📥 Commits

Reviewing files that changed from the base of the PR and between 73cf6e2 and d777443.

📒 Files selected for processing (2)
  • backend/app/api/ws/chat_namespace.py
  • backend/tests/api/ws/test_chat_namespace_fork_history.py
💤 Files with no reviewable changes (1)
  • backend/app/api/ws/chat_namespace.py

📝 Walkthrough

Walkthrough

The incremental task-join serialization removes avatar from user sender data while retaining user identifiers and adds fork-history test coverage.

Changes

Incremental sender serialization

Layer / File(s) Summary
Update sender payload and validation
backend/app/api/ws/chat_namespace.py, backend/tests/api/ws/test_chat_namespace_fork_history.py
User sender data now includes user_id and user_name without avatar; a test verifies serialization for a fork-history user subtask.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: removing invalid avatar access during backend task synchronization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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