Skip to content

fix(apps): run native CANNBot queries in UTF-8 mode - #708

Merged
david6666666 merged 2 commits into
mainfrom
codex/cannbot-utf8
Nov 26, 2026
Merged

david6666666 merged 2 commits into
mainfrom
codex/cannbot-utf8

Conversation

@Dong1017

@Dong1017 Dong1017 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Governing Issue and delivery slice

Refs #707

Anchors touched: none

Dong1017 delegated a Windows encoding fix for the native CANNBot adapter in #707.

Knowledge authorship declaration

{
  "schema_version": 1,
  "head_sha": "3e006052b47acfe487a1615d836c5e73139c421a",
  "human_only": false,
  "material_ai_authors": [
    {
      "tool": "Codex",
      "model_id": "unknown",
      "effort": "unknown",
      "role": "author"
    }
  ]
}

Changed artifacts and evidence

The native CANNBot Python subprocess now starts with -X utf8. Isolated mode ignores the parent's PYTHONUTF8, and InferRSI validates the resulting JSON as UTF-8. The regression test checks the real child interpreter arguments for explicit -X utf8, verifies isolated UTF-8 mode, and reads a synthetic Chinese title through the project search entry point.

On Windows with CPython 3.12.14, the base 7e2c4ab6 used GBK for the native pipe and rejected the official index's CeilDivision output as malformed JSON. The same CANNBot source revision 9a779e8c9fc2289dc5c089e791efd8d88bb4a7a6, v3 index, ascend/a2, hit cap of 5 and 75-second budget returned 5 external hits on 72c5d9b1. An independent Codex CLI agent followed the first hit's pinned open and the local reader verified 2,197 bytes, the revision and the card SHA-256. The agent received the read receipt and the source text stayed local. Agent call trace and paired replay in #388

Checks and dependencies

  • ruff check src tests tools passed on 3e006052.
  • Windows CANNBot boundary and channel acceptance tests on 3e006052 had 45 passed and 7 skipped. Five acceptance skips require an approved upstream checkout. The official-index replay above used a temporary project grant.
  • Removing -X utf8 made the updated regression fail. A control launch using -X utf8=1 enabled UTF-8 and passed the original test. The updated regression failed because the required -X utf8 argument pair was absent. Review thread
  • The initial Windows-wide test run picked up a different installed checkout in CLI subprocesses. The corrected worktree paths give passing gate-off tests on the base and patch.
  • On 3e006052, Windows pytest -x stopped after 288 passed and 6 skipped at test_all_actual_revision_bytes_retained_before_checks, which compares CRLF fixture bytes to LF. The named test failed with the same assertion on base 7e2c4ab6.
  • Ubuntu full-check passed on Python 3.10 and 3.11 for 72c5d9b1. GitHub's Windows and macOS host compatibility jobs passed. CI run

Remaining work and Issue closure

Ready for independent review. Dong1017 owns acceptance of #707.

Agent-assisted-by: Codex (author)
Signed-off-by: Dong1017 <[email protected]>
@Dong1017 Dong1017 added the area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters label Nov 26, 2026

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Dot, acting for @david6666666 under delegated PR review.

PR review verdict — PASS on the encoding fix; non-voting draft feedback, 76/100.

Revision, verification and score

Reviewed base 7e2c4ab6fdab68da10b13e1a03d21dd6f8fd6c22 and head 72c5d9b136c0f152dca9762935cbfd1b11f12a0b. Both changed files and the worker's capture and strict decode path were checked. A local synthetic replay of the pinned workers reproduced base rejection and head success in a non-UTF-8 context; under LC_ALL=C, the base also passed because the isolated interpreter automatically entered UTF-8 mode. This was not a rerun of the official Windows index. The current head's full and installed-package checks passed.

Scope 3/3 (#707), correctness 3/3 (explicit UTF-8, existing isolation and capture retained), validation 2/3 (fixture depends on the interpreter's default mode), claim evidence N/A (bugfix only; no model/campaign claim), simplicity 0/3 (the new explanatory source comment triggers the repository's scoring rule). Highest-priority follow-up: make the regression detect removal of the explicit UTF-8 flag regardless of host locale, and move the explanatory comment to docs if it is needed.

Comment thread tests/apps/test_cannbot_boundaries.py Resolved
@Dong1017
Dong1017 marked this pull request as ready for review November 26, 2026 07:21
zengchuang-hw
zengchuang-hw previously approved these changes Nov 26, 2026

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PASS
dot, acting for zengchuang-hw.

首审:base 7e2c4ab6fdab68da10b13e1a03d21dd6f8fd6c22 → head 72c5d9b136c0f152dca9762935cbfd1b11f12a0b。本提交满足 #707 编码修复范围:在 native worker 启动同一 Python 时保留 -I -B,增加 -X utf8,未削弱严格 JSON 解析、输出上限或超时。新增回归从正常 search 入口读取非 ASCII 标题。

验证和边界

独立运行:提取 base 与 head 的原始 _run / _strict,用真实隔离 Python 子进程和临时合成中文 JSON 对照。base 在 GBK 输出时拒绝;head 保持隔离和禁用字节码,正确返回中文标题。测试以标准库 subprocess 替代管道采集,未跑全套或在本机复跑 Windows/官方索引。另核对 同一 Windows 索引与 75 秒预算的作者记录:旧提交拒绝,新提交返回 5 条外部命中,首条 pin 回读校验一致。这不是默认 8 秒下的性能证明。

Agent-assisted-by: Codex (author)
Signed-off-by: Dong1017 <[email protected]>
@Dong1017

Copy link
Copy Markdown
Collaborator Author

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
Dot, acting for @david6666666 (repository admin) under delegated independent InferRSI PR review and approval.

PR review verdict — PASS. Advisory score: 100/100.

Revision, evidence and score

Reviewed base 7e2c4ab6fdab68da10b13e1a03d21dd6f8fd6c22 and head 3e006052b47acfe487a1615d836c5e73139c421a against #707. The two-file diff retains interpreter isolation and strict JSON decoding, expressly sets the child UTF-8 option, and checks both the real child argument pair and the returned Chinese title. My local isolated worker replay under LC_ALL=C rejected the base without the option and accepted the exact head with it. This resolves my earlier locale-dependent regression finding. Both Linux full checks and installed-package checks passed on the current head (CI). The linked Windows official-index replay is author evidence on the previous revision; I did not replay that external index, and the production worker change is unchanged from the tested revision.

Scope 3/3 (#707 boundary); correctness 3/3 (UTF-8 plus isolation and unchanged strict decode); validation 3/3 (current-head CI and independent local control); claim evidence N/A (no model or campaign claim); simplicity 3/3 (single focused flag and regression; earlier explanatory code comment removed). No blocking follow-up. This review does not accept or close #707.

@amy-why-3459 amy-why-3459 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
Dot, acting for @amy-why-3459.

Reviewed both files at 3e006052 against 7e2c4ab6 and the #707 encoding scope. The child explicitly enables UTF-8 while keeping -I -B, the existing capture limit and timeout, and the strict JSON decode. The synthetic search test checks the actual interpreter options and the returned Chinese title, so a host that defaults to UTF-8 cannot mask removal of the explicit flag. sys.orig_argv is within the supported Python range. All eight Ready jobs and the knowledge-policy check are green for this head.

I did not rerun the Windows official index; the linked 75-second paired run is author evidence from the preceding revision, with the same production worker change. It is not evidence about the default timeout.

@david6666666
david6666666 merged commit c45dde4 into main Nov 26, 2026
13 checks passed
@Dong1017
Dong1017 deleted the codex/cannbot-utf8 branch November 26, 2026 08:45

Copy link
Copy Markdown
Contributor

回应这条 PTAL:我已在 72c5d9b1 发表并 Approve。PR 已合入,最终 head 是 3e006052;这里不把早一版的批准当作对最终版本的新检视。

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

Labels

area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants