Import Codex CLI tab-status (gnachman/iTerm2#673), gated behind spawnterm.codex_status#65
Merged
Merged
Conversation
Bring in upstream "Show Codex CLI activity in tab status": Codex (OpenAI) does not emit OSC 21337; it signals working/idle by prefixing the OSC 0/1/2 terminal title with a braille-spinner glyph. A pure decoder (CodexTitleStatusDecoder) plus a foreground-job-gated adaptor (CodexTitleStatusAdaptor) synthesize the equivalent iTermSessionTabStatus, driven by a new always-on built-in "Codex Status" trigger riding a new "Title Changed" event-trigger category. Gated behind a new per-user spawnTerm feature flag `spawnterm.codex_status` (default OFF), toggled in Settings > General > AI > spawnTerm. The gate is enforced at the single choke point -[PTYSession screenApplyCodexTitleStatusWithTitle:]: when OFF, no synthesized Codex tab status is applied and behavior is stock. Flag added in all three synced places (spawnterm-flag, spawnterm_flag.py, iTermSpawnTermCapabilities.m) plus feature-flags.md; shell/python parity tests stay green. PTYSession.m merge preserves our prior #51 (user-var sidecar) and #49 (writeTask:completion: threading) changes; the gnachman#673 hooks are purely additive. New Trigger.h delegate method, VT100Screen side-effect plumbing, and the Title Changed event UI are included. Adapted from upstream gnachman#673 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
Review by tech-lead — code APPROVED by inspection; build UNVERIFIED (environment). Import mais invasivo (upstream gnachman#673). Boa decisão: usou o net diff squashado (a série de 4 commits se sobrescrevia). Verifiquei o merge crítico em
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #60
Summary
Imports upstream gnachman#673 ("Show Codex CLI activity in tab status") into the fork, gated behind a new spawnTerm feature flag so it is OFF by default.
Codex (OpenAI) does not emit iTerm's OSC 21337 status protocol; it signals working/idle state by prefixing the OSC 0/1/2 terminal title with a braille-spinner glyph while crunching and dropping it when idle. This PR:
CodexTitleStatusDecoder) for the braille-spinner title prefix (U+2800–U+28FF + space), and a foreground-job-gated adaptor (CodexTitleStatusAdaptor) that synthesizes the equivalentiTermSessionTabStatus(Working/Idle) only whencodexis the foreground job.iTermTriggerMatchTypeEventTitleChanged) with an optionaltitleRegexfilter, selectable/configurable like the other event triggers.CodexStatusTrigger) seeded byEventTriggerEvaluator, riding the Title Changed event; its side effect flows through a newtriggerSession:applyCodexTitleStatusWithTitle:delegate method (VT100Screen / VT100ScreenMutableState) to-[PTYSession screenApplyCodexTitleStatusWithTitle:].Feature flag (default OFF)
New capability
spawnterm.codex_status("Codex Tab Status"), added in all three synced places —spawnterm/flags/spawnterm-flag,spawnterm/flags/spawnterm_flag.py,sources/Settings/iTermSpawnTermCapabilities.m— plusspawnterm/docs/feature-flags.md. Toggled in Settings → General → AI → spawnTerm. Shell/Python parity tests (test_flags.sh) stay green (26/26).Gate point: the Codex-activity → tab-status behavior is gated at the single choke point
-[PTYSession screenApplyCodexTitleStatusWithTitle:]onisEnabledForCapability:@"codex_status". Both the trigger callback path and the foreground-job-change path funnel through it, so OFF ⇒ no synthesized Codex tab-status side effects (stock behavior).Conflict resolution (this is the most invasive import — edits iTerm2 core)
screenSetUserVar:,userVarSidecar, replay, GC, dealloc) and Tier 4.A — optional delivery ack on async_send_text (fork-direct) #49 (writeTask:completion:threading) changes are fully preserved; verified present post-merge. The Show Codex CLI activity in tab status gnachman/iTerm2#673 hooks are purely additive (a call insetCurrentForegroundJobProcessInfo:, the trigger fire inscreenSetWindowTitle:, and the newscreenApplyCodexTitleStatusWithTitle:method).triggerSession:applyCodexTitleStatusWithTitle:delegate declaration alongside existing ones; no conflict with fork additions.iTermTriggerMatchTypeEventTitleChanged = 116(fork already had…VariableChanged = 115, no collision).gh pr diff 673) to avoid the 4-commit series' internal churn (the PR reworks its own initial hook onto the trigger system). Hand-fixed rejects iniTermEventTriggerEvaluator.swiftandiTermSessionTabStatus.swift(fork context drift: our fork usesRLog, hasbackgroundTasks/broadcastsChangesadditions) preserving all fork code. New Swift files registered viatools/add_file_to_xcodeproj.rbintoiTerm2SharedARC; ModernTests auto-included via the synchronized group.Build status (HONEST)
Not verified as a green build — the environment cannot compile iTerm2.
tools/build.shaborts in the dependency phase, before any target sources compile, with:This is the known toolchain/submodule mismatch (Xcode 26.2 vs prebuilt-deps 26.5), unrelated to these changes. The change set was verified correct-by-inspection: PTYSession.m preserves #51+#49 and adds gnachman#673; every imported symbol resolves against the fork (
iTermSessionTabStatus(sessionID:),hasActiveStatus,apply(_:),maybePostTabStatusNotificationWithPreviousStatusText:,sessionTabStatusDidChange:,iTermVariableKeySessionForegroundJobAncestors, the Trigger scheduler API,iTermTriggerMatchTypeEventTitleChanged); no.rej/leakage; no submodule/ThirdParty/version-stamp changes.Provenance
Adapted from upstream gnachman#673.
🤖 Generated with Claude Code