Skip to content

🐛 Bugfix: Auto-clean account when exists in Supabase but not in postgresql#3002

Merged
WMC001 merged 7 commits into
developfrom
xyq/bugfix_frontend
May 19, 2026
Merged

🐛 Bugfix: Auto-clean account when exists in Supabase but not in postgresql#3002
WMC001 merged 7 commits into
developfrom
xyq/bugfix_frontend

Conversation

@xuyaqist
Copy link
Copy Markdown
Contributor

@xuyaqist xuyaqist commented May 18, 2026

  1. 清除仅存在supabse但是不存在我们数据库的用户
  2. 删除A2AAgent的type字段(在1.0协议版本中移除该字段)
  3. 延长session refresh的逻辑:如果用户在活跃状态时,如果session<30分钟过期,那么就会refresh token
  4. 当后端返回401,前端直接弹出登录页面

Copilot AI review requested due to automatic review settings May 18, 2026 02:50
@xuyaqist xuyaqist requested review from Dallas98 and WMC001 as code owners May 18, 2026 02:50
@xuyaqist xuyaqist changed the title Bugfix: Auto-clean account when exists in Supabase but not in postgre Bugfix: Auto-clean account when exists in Supabase but not in postgresql May 18, 2026
@xuyaqist xuyaqist changed the title Bugfix: Auto-clean account when exists in Supabase but not in postgresql 🐛 Bugfix: Auto-clean account when exists in Supabase but not in postgresql May 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to address inconsistent user state between Supabase and the local PostgreSQL DB by deleting “orphaned” Supabase accounts when the corresponding local tenant relationship is missing. It also changes the A2A response payload shape for message/task parts and adjusts image sizing in the agent-development documentation.

Changes:

  • Add Supabase admin-client deletion logic in get_user_info when user_tenant is missing.
  • Modify A2A adapter/server responses to omit type: "text" in generated parts objects (and in one place omit mediaType too).
  • Increase documentation screenshot image widths from 50% to 80% (EN/ZH).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
doc/docs/zh/user-guide/agent-development.md Increases embedded image width for A2A discovery screenshots.
doc/docs/en/user-guide/agent-development.md Same image width adjustment for English docs.
backend/services/user_management_service.py Deletes Supabase users when local tenant relationship is missing during user info lookup.
backend/services/a2a_server_service.py Changes emitted A2A parts objects (drops type, and in one path drops mediaType).
backend/services/a2a_agent_adapter.py Changes default/converted A2A parts shape (drops type, sometimes mediaType), impacting existing contract/tests.
Comments suppressed due to low confidence (4)

backend/services/a2a_agent_adapter.py:272

  • build_a2a_message_response now creates default text parts without a type field. Repository tests and existing payloads consistently include type: "text" for parts; dropping it will cause incompatibilities unless every consumer is updated. Consider restoring type (and keeping mediaType) for generated text parts.
        if parts:
            message_parts = parts
        elif text:
            message_parts = [{"text": text, "mediaType": _MEDIA_TYPE_TEXT}]
        else:
            message_parts = [{"text": "", "mediaType": _MEDIA_TYPE_TEXT}]

backend/services/a2a_agent_adapter.py:298

  • _content_to_artifact_parts returns parts without type, while other parts in the codebase/tests expect type: "text" (and often mediaType). To keep A2A artifact parts consistent and avoid downstream parsing issues, include type for generated text parts (and preserve mediaType).
        """Convert content/parts into artifact parts format."""
        if parts:
            return parts
        if isinstance(content, dict):
            if content.get("type") == "text":
                return [{"text": content.get("text", ""), "mediaType": _MEDIA_TYPE_TEXT}]
        return [{"text": str(content), "mediaType": _MEDIA_TYPE_TEXT}]

backend/services/a2a_agent_adapter.py:347

  • _message_to_parts_format now emits parts: [{"text": ...}] without type (and without mediaType). This will fail existing unit tests (they assert parts[0]["type"] == "text") and makes status messages inconsistent with other A2A responses. Please include type: "text" (and ideally mediaType: "text/plain") when synthesizing parts here.
            text = str(message)
        return {
            "role": role,
            "parts": [{"text": text}]
        }

backend/services/a2a_server_service.py:884

  • get_task now returns artifact parts as [{"text": ...}] (no type and no mediaType), while other responses in this module/adapter typically include at least mediaType: "text/plain" (and historically type). This inconsistency can break clients that rely on uniform Part objects. Consider including mediaType (and type if required) for artifact parts.
            if message:
                task_obj["artifacts"] = [{
                    "parts": [{"text": str(message)}],
                    "lastChunk": True
                }]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/services/a2a_agent_adapter.py
Comment thread backend/services/a2a_server_service.py
Comment thread backend/services/user_management_service.py Outdated
Comment thread backend/services/a2a_server_service.py
@xuyaqist xuyaqist force-pushed the xyq/bugfix_frontend branch from 688c34a to 8c1dcf3 Compare May 18, 2026 07:47
@WMC001 WMC001 merged commit f03704e into develop May 19, 2026
16 checks passed
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.

3 participants