Skip to content

fix(tui): 畸形读取响应返回稳定错误而不是崩溃(#82 切片) - #149

Merged
LIghtJUNction merged 1 commit into
mainfrom
fix/tui-slice-20260928
Sep 28, 2026
Merged

LIghtJUNction merged 1 commit into
mainfrom
fix/tui-slice-20260928

Conversation

@LIghtJUNction

Copy link
Copy Markdown
Member

概要

这是 #82 中 TUI「字段/错误恢复」验收的一个切片,不关闭 #82。

此前如果服务端或代理违反读取契约,TUI 的命令循环会直接抛出 AttributeError/KeyError,导致整个 TUI 退出。触发情形包括:data 不是对象、items 不是列表、条目不是对象、cursor 不是字符串、Files 的 profile 缺少绝对 path、Notes/Todos 条目缺少 name。

本 PR 的处理:

  • 上述畸形响应统一显示稳定错误码 invalid_read_response,清空可选的旧页面,仍然只能通过显式 retry 重新走签名读取;
  • 条目没有可读取的标识(缺 id、ref 不是对象、id 不是字符串)时,只提示「该条目没有可读取的标识。」,不会用 None 发起读取;
  • 客户端返回的冻结 JSON(MappingProxyType/tuple)仍然按合法页面处理。

没有新增任何写入、ACK、后台轮询或权限;TUI 仍然只读。

仍未完成(#82 保持开放)

  • 设计规定的 TUI 显式写入流程;
  • 真实 sshd/AuthorizedKeysCommand/ForcedCommand、tools sandbox/bwrap、DNS/redirect/SSRF、RSS/MCP 适配器矩阵;
  • 完整客户端矩阵和生产验收。

测试

  • 仅修改 src/msg/tui.py、tests/test_tui_transport_boundaries.py。
  • 本地使用真实 PostgreSQL 运行 python -m pytest tests/test_tui.py tests/test_tui_recovery.py tests/test_tui_transport_boundaries.py:54 passed,含两项真实 PG 的只读/撤权回归。
  • 这是本地 Python 环境的补充证据,不代替完整 CI 分片。

Made with Cursor

…crashing

A server or proxy that breaks the read contract (non-object data, non-list
items, non-object items, non-string cursor, missing profile path or item
identifiers) previously raised inside the command loop and ended the TUI.
Report invalid_read_response, clear the selectable page, keep explicit retry,
and never dereference entries without a readable identifier. Refs #82.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings September 28, 2026 15:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-28T16:02:23.241701Z bdbd0f4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@LIghtJUNction
LIghtJUNction merged commit f4e0ad5 into main Sep 28, 2026
11 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.

2 participants