Skip to content

feat: test auto ci#2108

Closed
CarltonXiang wants to merge 3 commits into
MemTensor:dev-v2.0.24from
CarltonXiang:feat/test-auto-ci
Closed

feat: test auto ci#2108
CarltonXiang wants to merge 3 commits into
MemTensor:dev-v2.0.24from
CarltonXiang:feat/test-auto-ci

Conversation

@CarltonXiang

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change, the problem it solves, the implementation approach, and relevant context. List any dependencies required for this change.

Related Issue (Required): Fixes #issue_number

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Checklist

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

Reviewer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed
  • Tests have been provided

@Memtensor-AI Memtensor-AI added area:docs 文档、示例 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Jul 15, 2026
@Memtensor-AI
Memtensor-AI requested a review from shinetata July 15, 2026 03:18
@Memtensor-AI

Copy link
Copy Markdown
Collaborator

🤖 Open Code Review

Target: PR #2108
Task: ceed6e2170036404
Base: dev-v2.0.24
Head: feat/test-auto-ci

🔍 OpenCodeReview found 1 issue(s) in this PR.

⚠️ 1 warning(s) occurred during review.


1. src/memos/log.py (L45)

This looks like a leftover debugging artifact. The fallback value "trace-id-test" is inconsistent with:

  • The non-exception fallback on line 43 ("trace-id")
  • The fallback used in CustomLoggerRequestHandler.emit() on line 87 ("trace-id")

Using a different string in the except branch would produce confusing log output in production and makes it impossible to distinguish between a "no trace ID available" situation and an exception during trace ID retrieval — unless that distinction was intentional, but it isn't communicated here.

Suggestion: Revert to "trace-id" to keep the fallback consistent, or use a clearly intentional and documented sentinel (e.g. "trace-id-error") if distinguishing the error path is genuinely desired.

💡 Suggested Change

Before:

            record.trace_id = "trace-id-test"

After:

            record.trace_id = "trace-id"

🧹 Filtered 2 low-confidence OCR finding(s) before posting/fix-loop (duplicate: 2).

Generated by cloud-assistant via Open Code Review.

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

🤖 Open Code Review

Target: PR #2108
Task: 56fa21b73ba5ad8c
Base: dev-v2.0.24
Head: feat/test-auto-ci

🔍 OpenCodeReview found 1 issue(s) in this PR.

⚠️ 1 warning(s) occurred during review.


1. src/memos/log.py (L55-L56)

The fallback assignments for api_path, env, user_type, and user_name were removed from this except block, but all three log formatters in LOGGING_CONFIG still reference those fields (e.g., %(api_path)s, %(env)s, %(user_type)s, %(user_name)s). When an exception is caught here and those attributes are absent from the record, the formatter will raise a KeyError/ValueError, breaking log output entirely on the error path.

Additionally, the fallback value "trace-id-test" appears to be a test/debug artifact — it should remain "trace-id" (or a similarly neutral sentinel) in production code.

💡 Suggested Change

Before:

        except Exception:
            record.trace_id = "trace-id-test"

After:

        except Exception:
            record.trace_id = "trace-id"
            record.api_path = "unknown"
            record.env = "prod"
            record.user_type = "normal"
            record.user_name = "unknown"

🧹 Filtered 2 low-confidence OCR finding(s) before posting/fix-loop (duplicate: 2).

Generated by cloud-assistant via Open Code Review.

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

🤖 Open Code Review

Target: PR #2108
Task: b81333939cc60e9c
Base: dev-v2.0.24
Head: feat/test-auto-ci

🔍 OpenCodeReview found 1 issue(s) in this PR.


1. src/memos/log.py (L55-L56)

Bug (blocking): Missing fallback assignments for env, user_type, user_name, and api_path in the exception handler.

The log formatters (standard, no_datetime, simplified) reference all five context fields — %(trace_id)s, %(api_path)s, %(env)s, %(user_type)s, and %(user_name)s — as format directives (see lines 173–179). The original code set all five to safe defaults in the except block. The new code only sets record.trace_id, leaving the other four attributes unset on the LogRecord. This will raise a ValueError: %(api_path)s ... not found (or similar KeyError) when the formatter tries to render the record, causing logging to silently break every time this exception path is taken.

Also, "trace-id-test" appears to be a test/debug leftover and should be a production-appropriate sentinel such as "trace-id".

Suggested fix:

💡 Suggested Change

Before:

        except Exception:
            record.trace_id = "trace-id-test"

After:

        except Exception:
            record.trace_id = "trace-id"
            record.env = "prod"
            record.user_type = "normal"
            record.user_name = "unknown"
            record.api_path = "unknown"

Generated by cloud-assistant via Open Code Review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs 文档、示例 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants