[CLI] Make --format human override agent auto-detection - #4878
Open
hanouticelina wants to merge 5 commits into
Open
[CLI] Make --format human override agent auto-detection#4878hanouticelina wants to merge 5 commits into
hanouticelina wants to merge 5 commits into
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
hanouticelina
marked this pull request as ready for review
September 11, 2026 13:33
Wauplin
reviewed
Sep 11, 2026
Wauplin
approved these changes
Sep 11, 2026
Wauplin
left a comment
Collaborator
There was a problem hiding this comment.
Nice fix, thanks you! Pre-approving with a nit :)
Co-authored-by: Lucain <lucain@huggingface.co>
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.
Related to #4860.
Summary
autoresolves toagent. Passing--format humanrestored the layout but not the rest: progress bars were disabled once at import and never re-enabled, andANSIcalledis_agent()directly so colors stayed off.set_mode()now derives everything from the resolved mode: progress bars on forhuman, off otherwise (unlessHF_HUB_DISABLE_PROGRESS_BARSis set, which keeps priority), and it tellsANSIwhether colors are on.ANSI.set_enabled()is the new toggle. Callers outside thehfCLI (login flow, tiny-agents CLI) don't set it and fall back tois_agent()as before.NO_COLORstill wins.jsonandquiettoo, not onlyagent. Seems right for machine-oriented modes.hf envare unchanged and keep usingdetect_agent().Example
In a pty with
TERM_PROGRAM=WarpTerminal, which is detected as thewarpharness:Before,
--format humangave the human layout but no progress bar and no colors:After:
Without
--format, the same command still resolves to agent mode (path=..., no bars).Note
Low Risk
CLI presentation only; respects existing env overrides and preserves non-CLI ANSI behavior via is_agent() fallback.
Overview
--format humannow fully overrides agent harness detection for terminal UX, not just layout.Output.set_mode()ties ANSI colors and progress bars to the resolved format: human turns both on; agent, json, and quiet turn colors off and progress bars off unlessHF_HUB_DISABLE_PROGRESS_BARSis already set (env still wins).ANSIgainsset_enabled()and an internal override so thehfCLI drives coloring from output mode; other callers keep the previousis_agent()fallback.NO_COLORis unchanged and still disables styling.Reviewed by Cursor Bugbot for commit b9abfa1. Bugbot is set up for automated code reviews on this repo. Configure here.