Skip to content

diagnose(shell): trace the grid size at output consumption (#194) - #195

Merged
JavaZeroo merged 1 commit into
mainfrom
diag/output-trace
Oct 29, 2026
Merged

JavaZeroo merged 1 commit into
mainfrom
diag/output-trace

Conversation

@JavaZeroo

Copy link
Copy Markdown
Owner

内容

新增 opt-in 的输出消费轨迹 TERMFORGE_OUTPUT_TRACE=<path>:每个被消费的输出块写一行

{"schema":"termforge-output-trace-v1","terminal":1,"t_ms":...,"offset":0,"bytes":347,"columns":111,"rows":7}
  • terminal 区分同一场景里的多个窗口;
  • offset/bytes 可和 output.bin 对齐到具体字节;
  • columns/rows 是消费该块时的网格尺寸。

runner 自动指向场景产物目录的 output-trace.jsonl。

动机(#194)

#194 已确认:resize 期间 ConPTY 的尾部重绘是按旧几何生成、被按新几何消费,错位量 = 高度差(本轮 10−7=3),导致行内容等长互换、选区失效。
要证实"新旧尺寸的先后",就需要"消费时刻的网格尺寸"这一证据——本 PR 提供的正是它。

本地验证

{"terminal":1,"t_ms":193934578,"offset":0,"bytes":347,"columns":111,"rows":7}
{"terminal":2,"t_ms":193934640,"offset":0,"bytes":105,"columns":74,"rows":17}

边界

Refs #194 #156

TERMFORGE_OUTPUT_TRACE records terminal id, byte offset, chunk size and current grid per consumed chunk, so a resize repaint can be shown to have been generated for the previous geometry while the grid already had the new one.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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
📝 Code Review ✅ Completed 2026-10-29T17:11:04.200209Z 5dd3a9d 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5dd3a9d5cb

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (trace_output_) {
trace_output_ << "{\"schema\":\"termforge-output-trace-v1\",\"terminal\":" << identity_
<< ",\"t_ms\":" << GetTickCount64()
<< ",\"offset\":" << trace_offset_ << ",\"bytes\":" << bytes.size()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record offsets into the shared capture file

In multi-session scenarios, every ShellWindow appends to the same TERMFORGE_CAPTURE_OUTPUT file configured by execute(), but trace_offset_ starts at zero independently for each window. Consequently, the second terminal's first trace entry reports offset 0 even though its bytes follow another terminal's output, and subsequent offsets remain incorrect whenever sessions interleave. This makes the new offset/geometry evidence point at unrelated bytes in output.bin, undermining resize diagnosis. Record the actual shared capture position for each chunk, or give each terminal a separate capture file whose offsets match this counter.

Useful? React with 👍 / 👎.

@JavaZeroo
JavaZeroo merged commit a7cd6ed into main Oct 29, 2026
13 of 16 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.

1 participant