Skip to content

[Bug] 中文长对话 update_session_state 写入 OTS 时失败,超过单个属性列值 2MB 长度上限 #131

Description

@ismochio

Describe the bug

conversation_service 的分片逻辑与 OTS 列上限计算逻辑冲突。

  1. conversation_service/utils.py 的 serialize_state 用 ensure_ascii=False 序列化;
  2. 超长对话 经过 to_chunks 按每片 1.5M 字符切;
  3. 但 1 汉字 = 3 字节,中文长对话 理论上 最高会 4.5MB,超过OTS 列上限的 2MB,出现写入失败

生产环境实际OTS 报错:
OTSParameterInvalid: The length of attribute column: 'state_0' exceeds the MaxLength:2097152 with CurrentLength:2334762

Environment

  • agentrun-sdk: 0.0.52
  • Python: 3.12

Additional context

宽表模型列限制:String:UTF-8编码,长度不超过2 MB。
https://help.aliyun.com/zh/tablestore/product-overview/limits-on-widecolumn-model#section-clc-vy8-d8y

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions