Skip to content

fix(runtime): preserve Codex transcript turn boundaries#271

Merged
innomentats merged 2 commits into
chaitin:mainfrom
kingfs:fix/runtime-codex-transcript-turn-boundary
Jul 13, 2026
Merged

fix(runtime): preserve Codex transcript turn boundaries#271
innomentats merged 2 commits into
chaitin:mainfrom
kingfs:fix/runtime-codex-transcript-turn-boundary

Conversation

@kingfs

@kingfs kingfs commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Preserve boundaries between consecutive Codex interactive turns in the runtime transcript.

The interactive session now keeps its buffered text writer and inserts a newline before a subsequent turn when the previous output did not end with one. This
prevents output from adjacent turns from being concatenated while avoiding redundant separators when a newline is already present.

Testing

  • npm test
    • 16 test files passed
    • 143 tests passed
  • npm run typecheck
  • git diff --check origin/main..HEAD

Checklist

  • Documentation updated when behavior or configuration changed. No documentation update is required because this is an internal transcript formatting fix
    with no configuration or interface changes.
  • Tests added or updated for user-visible behavior.
  • No secrets, private endpoints, internal certificates, or local runtime state included.

@monkeyscan

monkeyscan Bot commented Jul 13, 2026

Copy link
Copy Markdown

PR Title: fix(runtime): preserve Codex transcript turn bound...

Commit: 27b3f67

本次PR修复了Codex交互式会话中多轮对话时transcript缺少turn boundary的问题。主要变更:将BufferedTextWriter持久化为类字段,新增turnCount计数器,并在第二轮及以后的runHumanMessage调用时执行beginTurn(),在上一轮输出末尾追加换行符以实现回合分隔。测试新增了transcript字段的断言验证。经审查,变更逻辑自洽,没有发现引入安全、正确性或回归风险的问题。

@monkeyscan

monkeyscan Bot commented Jul 13, 2026

Copy link
Copy Markdown

PR Title: fix(runtime): preserve Codex transcript turn bound...

Commit: 9e08774

本次 PR 仅修改了 runtime/javascript/test/runtime.e2e.test.ts,新增一个 E2E 测试用例 "preserves turn boundaries across interactive Codex messages"。

该测试通过 runStreamCommand 模拟交互式 Codex 会话,向 stdin 依次发送 starthuman_message("first")、human_message("second")和 eof 帧,然后捕获 stdout 输出并断言最终 result 帧的 transcript 字段正确保留了两次消息的转录边界({"input":"first"}\n{"input":"second"})。

测试覆盖了前序 fix commit 中修复的 Codex 交互式消息 turn boundary 丢失问题。测试逻辑与 stream.tsinteractive.tsrunners/codex.ts 的实现一致:每轮 human_message 触发 runStreamedBufferedTextWriter 在轮次切换时通过 beginTurn() 插入换行,最终 transcript 以换行分隔各轮输出。断言聚焦于最终结果帧的 transcript,符合该测试的回归防护目标。

整体评估:变更范围单一、意图明确,测试代码结构清晰,未发现正确性、安全性或可维护性方面的可执行问题。

@innomentats
innomentats merged commit 140036c into chaitin:main Jul 13, 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