Skip to content

feat(tui): add stable iTerm2 Pet rendering - #9

Open
snowykr wants to merge 8 commits into
devfrom
research/iterm2-pet-support
Open

feat(tui): add stable iTerm2 Pet rendering#9
snowykr wants to merge 8 commits into
devfrom
research/iterm2-pet-support

Conversation

@snowykr

@snowykr snowykr commented Jul 23, 2026

Copy link
Copy Markdown
Owner

iTerm2 Pet rendering with bounded raster ownership

This fork-only PR adds capability-gated iTerm2 Pet rendering while preserving the existing renderer and non-iTerm image protocols.

No upstream branch, PR, or repository metadata has been changed.

User-visible behavior

  • Renders the full animated Pet GIF through OSC 1337 only after verified iTerm2 capability negotiation.
  • Supports direct iTerm2 and explicitly managed tmux/iTerm2 transport; rejects unmanaged tmux, GNU screen, and Zellij contexts rather than emitting unsafe raw multipart records.
  • Places the three-row transparent GIF canvas on the composer’s top border, input row, and bottom border.
  • Suppresses the iTerm temporary Pet GIF drag-drop path at the bracketed-paste boundary without changing ordinary file-path input.
  • Suspends and erases the Pet while manual history hides the composer, then reacquires it on live follow.

Raster lifecycle and compatibility

  • Uses a bounded raster lease with cursor-guarded old-footprint erase before semantic GIF replacement.
  • Preserves differential renderer clipping and the active lease across streaming viewport repaints, preventing GIF erase/re-upload flicker while work output grows.
  • Keeps the host scrollback and manual-history viewport behavior isolated from iTerm raster placement; manual history explicitly suspends and erases the lease.
  • Settles queued render generations at the terminal write boundary, including managed iTerm transport barriers.
  • Refreshes cell metrics after managed transport activation and terminal resize.
  • Keeps Kitty, Sixel, ordinary renderer, native scrollback, and manual viewport behavior isolated from the iTerm-specific transport path.
  • Does not use DECSTBM, DECSCA, alternate-buffer switching, or a global renderer rewrite.

Review hardening

The implementation includes focused fixes for real lifecycle boundaries found during review: multiplexer admission, managed tmux passthrough restoration, non-destructive probe input draining, stale raster ownership, terminal cleanup ordering, geometry freshness, and Kitty image-ID lifetime. These changes stay within the Pet transport/lease boundary and its directly affected TUI tests.

Validation

Automated on this exact head:

bun test packages/coding-agent/test/gajae-pet-widget.test.ts \
  packages/coding-agent/test/qa-iterm-pet.test.ts \
  packages/coding-agent/test/qa-pet-restore-redteam.test.ts \
  packages/coding-agent/test/modes/components/iterm-pet-transport.test.ts \
  packages/tui/test/gajae-pet.test.ts \
  packages/tui/test/iterm2-protocol.test.ts \
  packages/tui/test/raster-lease.test.ts \
  packages/tui/test/render-commit.test.ts \
  packages/tui/test/terminal-detach.test.ts
# 184 pass / 0 fail / 757 assertions

bun --cwd=packages/tui run check
bun --cwd=packages/coding-agent run check
git diff --check

Manual iTerm2 validation covered composer placement, idle/working transitions, direct GIF rendering, manual-history suspension/reacquisition, and drag-drop path suppression. The PTY capture artifact used during investigation remains untracked and is intentionally excluded from this PR.

Release notes

packages/coding-agent/CHANGELOG.md and packages/tui/CHANGELOG.md include Unreleased entries for the new iTerm2 Pet surface.

@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: 99cceea4e9

ℹ️ 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/coding-agent/src/modes/components/gajae-pet-widget.ts

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

ℹ️ 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/coding-agent/src/modes/components/gajae-pet-widget.ts Outdated
Comment thread packages/coding-agent/src/modes/components/gajae-pet-widget.ts Outdated
@snowykr
snowykr force-pushed the research/iterm2-pet-support branch 3 times, most recently from 754006b to 9094929 Compare July 23, 2026 06:35

@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: 86bf7a5764

ℹ️ 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/coding-agent/src/modes/components/iterm-pet-transport.ts Outdated
Comment thread packages/coding-agent/src/modes/components/iterm-pet-transport.ts Outdated

@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: 988a52a547

ℹ️ 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/coding-agent/scripts/qa-iterm-pet.ts Outdated

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

ℹ️ 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/tui/src/terminal.ts Outdated
@snowykr
snowykr force-pushed the research/iterm2-pet-support branch 3 times, most recently from 42c9d9f to 3277a47 Compare July 23, 2026 09:41
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from d5fa880 to f70ae33 Compare July 23, 2026 10:50
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from f70ae33 to 5363011 Compare July 23, 2026 11:03
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from 5363011 to e3ae830 Compare July 23, 2026 11:04
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@snowykr

snowykr commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@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: 826b2f799c

ℹ️ 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/coding-agent/src/modes/components/iterm-pet-transport.ts Outdated
@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from 4031dba to c678db0 Compare July 23, 2026 13:22
@snowykr

snowykr commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

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

ℹ️ 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/coding-agent/src/modes/components/iterm-pet-transport.ts Outdated
Comment thread packages/tui/src/tui.ts
@snowykr

snowykr commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

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

ℹ️ 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/coding-agent/src/modes/components/gajae-pet-widget.ts
Comment thread packages/coding-agent/test/fixtures/iterm-pet-captures/3.5.0/direct/manifest.json Outdated
@snowykr

snowykr commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@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: 6e7f04633a

ℹ️ 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/tui/src/terminal-capabilities.ts
@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from 6e7f046 to 817d259 Compare August 1, 2026 15:30
@snowykr snowykr changed the title feat(tui): add stable iTerm2 pet rendering feat(tui): add stable iTerm2 Pet rendering Aug 1, 2026

@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: 817d2599f4

ℹ️ 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/coding-agent/src/modes/components/iterm-pet-transport.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive-mode.ts
Comment thread packages/tui/src/tui.ts
Comment thread packages/coding-agent/scripts/qa-iterm-pet.ts Outdated
Comment thread packages/tui/src/terminal-capabilities.ts
@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from 817d259 to b8db948 Compare August 1, 2026 16:00

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

ℹ️ 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/coding-agent/src/modes/components/iterm-pet-transport.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive-mode.ts Outdated
Comment thread packages/coding-agent/scripts/qa-iterm-pet.ts Outdated
Comment thread packages/coding-agent/test/modes/components/iterm-pet-transport.test.ts Outdated
@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from b8db948 to fb8ee70 Compare August 1, 2026 16:12

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

ℹ️ 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/coding-agent/src/modes/components/iterm-pet-transport.ts
Comment thread packages/coding-agent/test/gajae-pet-widget.test.ts Outdated
Comment thread packages/tui/test/virtual-terminal.ts Outdated
@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from fb8ee70 to 66db9f7 Compare August 1, 2026 16:21

@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: 66db9f736c

ℹ️ 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/tui/src/tui.ts
Comment on lines +4629 to +4633
this.#rasterLeases.size > 0 &&
this.#rasterCleanup.size === 0 &&
!newLines.slice(Math.max(0, newLines.length - height)).some(line => TERMINAL.isImageLine(line))
) {
viewportRepaint("changed frame with active raster lease");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve native scrollback while a raster lease is active

When the iTerm Pet holds its normal long-lived raster lease, every changed frame is routed through viewportRepaint(), including transcript growth. That repaint uses absolute cursor positioning and emits no scrolling newline, then records the new frame as #previousLines; subsequent appends therefore never admit those rows into native terminal scrollback, and removing the lease later cannot recover them because they are no longer considered changed. Users who leave the Pet enabled can consequently lose the entire session transcript from host scrollback; invalidate/reacquire the lease around scroll-producing appends or otherwise preserve native admission.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 4bf34d2. A growing frame that advances the live viewport now releases the raster lease before using the normal scroll-producing renderer; non-scrolling frames continue clipping around the active lease. Added a native-scrollback regression in raster-lease.test.ts. Verified: focused Pet/TUI suite 183 pass / 0 fail / 748 assertions; bun --cwd=packages/tui run check; bun --cwd=packages/coding-agent run check; git diff --check.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The 4bf34d2 lease-release change caused a live iTerm regression: streaming work output erased and reacquired the GIF on each scroll, producing visible Pet flicker. It has been reverted in fork head 01280a7, restoring continuous lease-backed viewport repaint during streaming. The regression test again asserts no erase/re-upload during overflow. Focused TUI validation: 61 pass / 0 fail / 270 assertions; bun --cwd=packages/tui run check; git diff --check. Keeping this thread open because the original native-scrollback concern needs a design that does not sacrifice live animation continuity.

Comment thread packages/tui/src/tui.ts
Add lease-based OSC 1337 GIF rendering for iTerm2 while preserving Sixel, Kitty, tmux, viewport, and ordinary renderer behavior.
@snowykr
snowykr force-pushed the research/iterm2-pet-support branch from 66db9f7 to 074002d Compare August 1, 2026 16:28

@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: 074002d17a

ℹ️ 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/tui/src/tui.ts
Comment thread packages/coding-agent/test/qa-iterm-pet.test.ts Outdated
A protected iTerm raster lease must yield before a transcript append scrolls.
Queued render writes now settle their generation at the terminal write boundary.

Tested: TUI raster lease, render commit, render regressions, overlay scroll, detach, Pet, and iTerm protocol suites
Confidence: high
Scope-risk: narrow

@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: 4bf34d2548

ℹ️ 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/coding-agent/src/modes/components/iterm-pet-transport.ts
snowykr added 5 commits August 2, 2026 01:44
A synchronous terminal stop could overtake queued lease cleanup.
Flush active lease erases before terminal teardown.

Tested: TUI raster lease and render commit suites
Confidence: high
Scope-risk: narrow
Releasing the lease on every scroll-producing append re-uploaded the Pet and
caused visible animation flicker during active work. Keep the lease while the
live viewport is repainted.

Tested: raster lease, render commit, Pet, and iTerm protocol TUI suites
Confidence: high
Scope-risk: narrow
The Pet QA fixture test used synchronous named Node filesystem APIs.
Use Bun content I/O and promised namespace directory APIs instead.

Tested: qa-iterm-pet test and coding-agent check
Confidence: high
Scope-risk: narrow
An isolated Escape is user input, not a capability fragment.
Keep multi-character OSC fragments buffered while forwarding standalone Escape.

Tested: iTerm Pet transport test and coding-agent check
Confidence: high
Scope-risk: narrow
The Pet PR does not need unrelated QA report path or timestamp changes.
Restore the fork base versions to keep review scope bounded.

Confidence: high
Scope-risk: narrow

@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: 6567ed305a

ℹ️ 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 +544 to +546
} catch {
if (!isCurrent()) return this.availability;
return this.#finish("topology-ineligible");

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 Restore pane state when client discovery throws

When the managed tmux runner throws during a later list-clients poll, this catch calls #finish() rather than revoke(), so a pane whose allow-passthrough option was enabled during probing remains modified indefinitely while discovery keeps failing. The earlier nonzero-status branch now restores the option, but this neighboring exception branch is fresh evidence that spawn or command-runner exceptions still bypass restoration.

Useful? React with 👍 / 👎.

Comment on lines +105 to +108
const componentBytes = stats.gifBytes + stats.multipartBytes + stats.tmuxDcsBytes;
if (
stats.size !== MAX_ENTRIES ||
stats.bytes !== componentBytes ||

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 Include base64 bytes in the benchmark consistency check

getGajaePetGifCacheStats().bytes includes base64Bytes, but componentBytes sums only GIF, multipart, and tmux-DCS bytes. Since every cached artifact has a nonempty base64 representation, this equality is always false and the newly added benchmark always throws before reporting timing results.

Useful? React with 👍 / 👎.

The raster barrier regression now proves the generation remains pending and
the updated frame is written only after the barrier releases.

Tested: render-commit test and TUI check
Confidence: high
Scope-risk: narrow

@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: 424a11fca1

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

export function getPetPixelProtocol(): PetPixelProtocol | null {
if (TERMINAL.imageProtocol === ImageProtocol.Kitty) return "kitty";
if (TERMINAL.imageProtocol === ImageProtocol.Sixel) return "sixel";
if (verifiedItermAvailability?.available) return "iterm";

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 Honor forced graphics-off before enabling iTerm pets

When GJC_FORCE_IMAGE_PROTOCOL=off or PI_FORCE_IMAGE_PROTOCOL=off is set in iTerm, terminal-capabilities.ts intentionally leaves TERMINAL.imageProtocol null and suppresses runtime capability probes, but this fallback returns "iterm" once the independent transport verifies. InteractiveMode then reapplies the saved Pet mode and emits multipart GIF records, defeating the user's explicit graphics opt-out; gate the iTerm transport or this fallback on the forced-protocol setting, including forced off.

Useful? React with 👍 / 👎.

}
},
});
this.#itermPetTransport = createNativePetTransport({ ui: this.ui });

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 Register Pet teardown with signal cleanup

When a managed iTerm session exits through SIGINT, SIGTERM, or SIGHUP instead of the graceful /quit path, postmortem runs the registered terminal/session cleanup but this newly created transport and widget have no postmortem teardown. Consequently the raster may remain visible and the pane's saved allow-passthrough value may never be restored before process exit; register a bounded, awaited Pet cleanup that runs before terminal restoration.

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