anthropics / anthropics/claude-code

Background session hosts strip TERM_PROGRAM, so statusline OSC-8 hyperlinks are dead in background sessions

Open
#81,128 1 comment 0 reactions 1 assignee Claimed by @bogini View on GitHub
area:agent-view reproduced
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

**Version:** 2.1.220 (macOS 15 / darwin, Ghostty 1.3.1)

**Summary:** Claude Code gates statusline footer hyperlink (OSC-8) support on `TERM_PROGRAM` — but when it spawns background-session hosts, it strips that variable from the child environment. Result: a custom `statusLine` command that emits OSC-8 hyperlinks works perfectly in normal terminal sessions, but in background sessions the labels render (SGR colors survive) while the hyperlink regions never arm — the links are dead text, even though the user is viewing the session in an OSC-8-capable terminal (Ghostty).

**Evidence (process chain on one machine, same moment):**

| process | TERM_PROGRAM | TERM |
|---|---|---|
| `claude` (main, launched in Ghostty) | `ghostty` | `xterm-ghostty` |
| `claude bg-pty-host` (its child) | *(stripped)* | `xterm-ghostty` |
| `claude bg-spare` (session host) | *(stripped)* | `xterm-256color` (rewritten) |

The parent process has the full terminal identity; the background host chain loses it. Since the statusline subprocess and the footer renderer both live under the background host, hyperlinks are unconditionally dead there, and no user-side workaround exists (we verified `launchctl setenv` can't help — the variable is present in the parent and removed on spawn; recovering it inside the statusline script doesn't help either because the *footer renderer's* gate is what strips the links).

**Ask (either would fix it):**
1. Preserve `TERM_PROGRAM` / `TERM_PROGRAM_VERSION` (and the original `TERM`) when spawning `bg-pty-host` / `bg-spare`, or
2. Gate footer hyperlink support on the *viewing* client's terminal rather than the session host's environment.

**Related:** #80911 (enroll footer regex badges in the Down+Enter selection ring) — same theme: footer links as a first-class navigation surface.

**Repro:**
1. Configure a `statusLine` command that emits an OSC-8 hyperlink (BEL-terminated, per docs).
2. Open a normal session in Ghostty/iTerm — link renders and cmd+click works.
3. Open a background session (`claude` background jobs) viewed in the same terminal — same statusline output, label visible, click region absent.
4. `ps eww` the `bg-pty-host`/`bg-spare` processes: `TERM_PROGRAM` is gone.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.