Skip to content

Retain useful command output context - #111

Merged
ariobarin merged 3 commits into
mainfrom
perf/command-output-retention
Jul 28, 2026
Merged

Retain useful command output context#111
ariobarin merged 3 commits into
mainfrom
perf/command-output-retention

Conversation

@ariobarin

Copy link
Copy Markdown
Owner

Summary

  • retain a bounded beginning and rolling tail for each command stream
  • preserve diagnostic stderr even when stdout is noisy
  • keep the combined public result within the existing 12 KiB limit
  • preserve complete UTF-8 character boundaries in truncated results

Verification

  • npm run check
  • git diff --check
  • independent review found no correctness regression

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
glossa Ignored Ignored Preview Jul 28, 2026 4:21pm

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 638f0fb960

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

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 33b441e34f

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

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: ba4c860008

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

@ariobarin
ariobarin force-pushed the perf/concurrent-worker-dispatch branch from 35c17ca to 4724ce4 Compare July 28, 2026 15:36
@ariobarin
ariobarin force-pushed the perf/command-output-retention branch from ba4c860 to 977fb6b Compare July 28, 2026 15:36

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 977fb6b9bd

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

Copy link
Copy Markdown
Owner Author

@codex review

@ariobarin
ariobarin force-pushed the perf/concurrent-worker-dispatch branch from bf59894 to 0cde887 Compare July 28, 2026 15:56
@ariobarin
ariobarin force-pushed the perf/command-output-retention branch from bd20c64 to ac39548 Compare July 28, 2026 15:56

@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: ac395481bb

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

Comment thread packages/cli/src/worker/command-service.ts Outdated
@ariobarin
ariobarin force-pushed the perf/concurrent-worker-dispatch branch from 0cde887 to d30a5dd Compare July 28, 2026 16:06
Base automatically changed from perf/concurrent-worker-dispatch to main July 28, 2026 16:10
@ariobarin
ariobarin force-pushed the perf/command-output-retention branch from ac39548 to cec7cbc Compare July 28, 2026 16:10
@ariobarin
ariobarin merged commit 350f8d2 into main Jul 28, 2026
19 checks passed
@ariobarin
ariobarin deleted the perf/command-output-retention branch July 28, 2026 16:24

@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: 41ec296f3f

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

Comment on lines +171 to +175
while (
start < buffer.byteLength &&
(buffer[start]! & 0b1100_0000) === 0b1000_0000
) {
start += 1;

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 Preserve malformed bytes in the retained tail

When output exceeds the limit and its rolling tail begins with invalid UTF-8 continuation bytes (for example, a binary command emitting repeated 0x80), this loop skips every such byte rather than decoding them as replacement characters. If the entire tail has this form, the returned result contains only part of the head and leaves most of the 12 KiB budget unused, contrary to the promised rolling-tail behavior; discard only bytes that belong to a boundary-split valid character while retaining malformed tail diagnostics.

Useful? React with 👍 / 👎.

Comment on lines +210 to +211
if (budget <= 0 || stream.totalBytes === 0) {
return { content: "", truncated: stream.totalBytes > 0 };

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 Don't report partial UTF-8 as truncated

For a running command whose latest chunk ends partway through a multibyte UTF-8 character, retainedBytes omits the pending bytes and can allocate a zero or smaller decoded budget, causing this branch to set stdoutTruncated or stderrTruncated even though the stream is well below the result limit. The flag can then revert to false when the remaining bytes arrive, and clients may incorrectly conclude that output was permanently omitted; pending decoder bytes should not count as budget truncation.

Useful? React with 👍 / 👎.

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