Repository navigation
[CLI] auto mode picks agent for Warp users: progress bars and colors silently disabled (TERM_PROGRAM=WarpTerminal) #4860
Description
Activity
Hi — I'd like to work on this if it is still open.
I checked the description against the current detection path: Warp is matched via
TERM_PROGRAM=WarpTerminalin the agent harness registry, andOutputFormat.autotreats anyis_agent()hit as agent mode (disabling progress bars/colors). Unlike other harnesses, that env var is set for every Warp shell, not only when Warp Agent Mode is driving the CLI — so interactive humans lose bars/colors.Plan (hub-side, minimal):
- Stop classifying Warp solely from
TERM_PROGRAM=WarpTerminalforautomode (or gate it on a Warp-Agent-only signal / interactive TTY check — happy to follow maintainer preference). - Keep an explicit
--output agent/ env override path working. - Add a unit test that
TERM_PROGRAM=WarpTerminalalone does not force agent mode when stdin/stdout look interactive. - Note the twin registry entry in
huggingface.jsif a follow-up there is needed for consistency.
Could a maintainer assign this to me (or confirm the preferred detection rule) before I open a PR?
- Stop classifying Warp solely from
Hi @xbsheng @SuhrudhC thanks for the report. If I understand correctly, the good way of fixing this would be to update the Warp Agent detection system. Currently we use
"warp": { "envVars": { "TERM_PROGRAM": "WarpTerminal" } }to check if it runs on Warp. Is there any environment variable we could check instead that would trigger only on Warp Agent and not on all Warp sessions? If yes, then I'd be happy to review a PR in
huggingface.js. If not, we might consider removing the Warp auto detection altogether 😕 (or maybe Warp itself can be updated to add a new agent-only env variable?)In any case, what I don't want to do is to rely on an extra flag for users to pass in their CLI, or to rely on auto-detection of TTY status. We've done that in the past, and there has never been a consistent way of being sure we can distinguish between TTY and non-TTY (there are soooo many corner cases around this...)
Thanks @Wauplin — and @SuhrudhC for picking this up. I dug into the Warp side before proposing anything, so here's a direct answer to your question.
No, Warp does not set any Agent-Mode-only environment variable. An
envdump from a plain, human-driven Warp terminal (local shell, no agent running) contains:TERM_PROGRAM=WarpTerminal TERM_PROGRAM_VERSION=v0.2026.09.02.08.27.stable_01 WARP_CLIENT_VERSION=v0.2026.09.02.08.27.stable_01 WARP_CLI_AGENT_PROTOCOL_VERSION=1 # sounds agent-related, but set in EVERY Warp shell WARP_IS_LOCAL_SHELL_SESSION=1 WARP_HONOR_PS1=1 WARP_TERMINAL_SESSION_UUID=... WARP_FOCUS_URL=warp://session/...TERM_PROGRAM=WarpTerminalonly means "this is a Warp terminal", not "an agent is driving this command".WARP_CLI_AGENT_PROTOCOL_VERSIONis the closest-sounding candidate, but it's a protocol-capability flag present in every Warp shell (feature-flag gated), never an agent marker. The only agent-ish vars I found in the Warp binary (WARP_SKILL_DIRS,WARP_SANDBOX_DEADLINE,WARP_API_KEY) belong to the separateoz/ cloud-agent CLI, not to terminal Agent Mode.The structural reason: Warp Agent Mode doesn't spawn a new process or a new session. It writes commands into the same already-running shell session (same PTY) as the human, so the command inherits exactly the human shell's environment. There is nothing env-based to key on — a marker would have to be added by Warp itself.
Given that, I went with removing the entry:
- huggingface.js PR: Remove warp agent harness from registry huggingface.js#2476 — drops
warp: { envVars: { TERM_PROGRAM: "WarpTerminal" } }fromAGENT_HARNESSES. If Warp later ships an agent-only marker (e.g.AI_AGENT=warp/AGENT=warpor a dedicatedWARP_AGENT_*var), the standard-var path picks it up with no further change. This also stops_headers.pyfrom tagging every human Warp request asagent/warp, which was polluting the agent-usage attribution data.
huggingface_hub PR (small, orthogonal — happy to close it if you prefer to keep the hub side untouched): #4879 —
set_mode(human)now callsenable_progress_bars(), fixing the case where the CLI starts in agent mode and a later explicit--format humankeeps progress bars disabled. No TTY sniffing involved.- huggingface.js PR: Remove warp agent harness from registry huggingface.js#2476 — drops
- Reacted by xbshengReacted by xbsheng
Thanks @Wauplin and @xbsheng — that investigation is very clear.
I'll step back here. Removing Warp from the
huggingface.jsharness registry (huggingface/huggingface.js#2476) plus the Hub--format humanoverride path looks like the right approach, especially given there's no agent-only env var today. Happy to help elsewhere if useful.- added a commit that references this issue
on Sep 23, 2026
Summary
Running any
hfcommand from a Warp terminal silently switches the CLI toagentoutput mode: no progress bars, no colors.automode is documented as "pickshumanfor an interactive terminal andagentwhen the CLI is invoked by an AI agent" (docs/source/en/guides/cli.md), but the implementation only looks atis_agent()— it never checks whether the process is attached to an interactive terminal. SinceTERM_PROGRAM=WarpTerminalis set in every Warp shell (not only when Warp's Agent Mode drives a command), every human using the CLI in Warp loses progress bars.Root cause
utils/_detect_agent.pymatches the Hub registry entry:(
warpis the only harness keyed onTERM_PROGRAM; same registry lives inhuggingface.js/packages/tasks/src/agent-harnesses.ts:199-205, added in huggingface/huggingface.js#2222 — where the analogous Zed entry usesZED_TERM, which only the integrated terminal sets.)cli/_output.py:63-69then does:utils/_terminal.py:102does the same for ANSI colors (if os.environ.get("NO_COLOR") or is_agent(): return s).Repro
hf 1.30.0/huggingface_hub 1.30.0, macOS 15.7.5, Warp 0.2026.09.02, Python 3.10, in a real pty:Same command, output size captured via
pty.fork()(90.9 MB file):TERM_PROGRAMTQDM_POSITION=-1WarpTerminalpath=...)Apple_Terminalxterm-256color(
PI_CODING_AGENT=true/AI_AGENT=pialso trigger agent mode, which is intended. The problem is variables a terminal emulator sets for all sessions.)Two related gaps
--format humandoes not restore the bars.set_mode(human)changes rendering (back to✓ Downloaded/path: ...) but never callsenable_progress_bars(), and the global disable already happened inOutput.__init__. In a pty:hf download ... --format human→ 61 B, still no bar.hub-docs/docs/hub/agents-overview.md("Register your agent harness"), registering a harness attributes Hub traffic via the user agent (utils/_headers.py:187appendsagent/warp). So human Warp users' requests are currently counted as Warp agent usage in the agent-usage dataset — same false positive, with a data-quality consequence.Suggested fixes
huggingface_hub: inset_mode(auto), only pickagentwhen not attached to an interactive terminal (e.g.not sys.stderr.isatty()), and/or skipdisable_progress_bars()when stderr is a tty. Makingset_mode(human)callenable_progress_bars()also fixes the--format humancase.huggingface.js: key thewarpentry on a variable that is only present in Agent Mode, or distinguish "attribution-only" entries from "agent-driven output" entries in the registry.Workaround
env -u TERM_PROGRAM hf download ...(orTERM_PROGRAM= hf download ...), plusTQDM_POSITION=-1when stderr is not a tty.