fix: default PROMPT_EOL_MARK= in spawned shells#114
Merged
Conversation
Spawned shells now default PROMPT_EOL_MARK to empty so zsh's standout "%" end-of-partial-line marker no longer leaks into snapshots, screenshots, and recordings. agent-tty strips a hidden per-run completion-marker postamble, which desynced the rendered cursor from the shell's and left the "%" visible. The marker is zsh-only and inert in other shells. The default is applied at PTY spawn time in resolvePtyEnv and is not written to the manifest, so inspect/list/create --json env maps are unchanged. An explicit `--env PROMPT_EOL_MARK=...` always wins (use '%B%S%#%s%b' to restore zsh's styled default; a lone '%' expands to nothing). Change-Id: Ia6f199bb33e52baff73a008a39c74500e5c5e050 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Kosiewski <tk@coder.com>
7776fed to
5d68553
Compare
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.
What
Spawned shells now default
PROMPT_EOL_MARK=(empty) in the session environment. This suppresses zsh's inverse-video%end-of-partial-line marker, which was leaking into snapshots, screenshots, and recordings.Why
agent-ttyinjects a hidden completion-marker postamble after eachrunand strips that postamble's echo from the output stream. The strip leaves the rendered cursor mid-line, so zsh's unconditional end-of-line mark (PROMPT_EOL_MARK, default%B%S%#%s%b) surfaces as a stray standout%in captured artifacts. In a real terminal it's overwritten at column 0; inagent-tty's renderer it stays visible.Before / after (
echo hellosnapshot):How
A new pure, testable
resolvePtyEnv(env, term, baseEnv)helper insrc/pty/createPty.tsassembles the shell env with precedence (lowest→highest): inherited process env →PROMPT_EOL_MARK=''default → caller--env→TERM. The default is gated on'PROMPT_EOL_MARK' in env(the user-explicit set), so a--envvalue always wins — even an explicit empty one — and is ordered after the inherited env so it also overrides an inherited value, keeping captures deterministic.The marker is zsh-only and inert in other shells (bash, etc.), so it's safe to set unconditionally. The default is applied at PTY spawn time and is not written to the manifest, so
inspect,list, andcreate --jsonenv maps are unchanged.Notes & caveats (documented in
docs/USAGE.md/docs/TROUBLESHOOTING.md)agent-tty create --env PROMPT_EOL_MARK='%B%S%#%s%b' -- <shell>restores zsh's styled default. A lone'%'does not restore it (zsh treats it as a prompt escape that expands to nothing).~/.zshrcthat reassignsPROMPT_EOL_MARKruns after env import and wins — best-effort, documented.Tests
test/unit/pty/createPty.test.ts): default injected, caller value wins (incl. empty), overrides inherited,TERMforcing, undefined-drop.test/integration/lifecycle.test.ts): parent exports a sentinelPROMPT_EOL_MARK; asserts the spawned shell sees it empty — verified to fail without the fix and pass with it.🤖 Generated with Claude Code