Skip to content

[CLI] Hint agents to group related Jobs with a shared label - #5405

Draft
moon-bot-app[bot] wants to merge 1 commit into
mainfrom
moonbot/slack-jobs-agent-group-label-hint-1795186222
Draft

moon-bot-app[bot] wants to merge 1 commit into
mainfrom
moonbot/slack-jobs-agent-group-label-hint-1795186222

Conversation

@moon-bot-app

@moon-bot-app moon-bot-app Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Coding agents tend to launch lots of related Jobs in one session (sweeps, retries, quick experiments) with no shared label, so they show up as an ungrouped list in the UI. This PR adds a hint to nudge them toward grouping. The idea came from an internal Slack discussion.

  • When is_agent() is true, hf jobs run, hf jobs uv run and hf jobs rerun (via _hint_or_follow_started_job) print one more hint after the Job starts:
    • if the Job already has labels other than name: reuse those exact --label flags (with a unique --name per Job) for later Jobs in the session.
    • otherwise: a concrete label to reuse, --label group=<first 8 chars of job id>, plus the hf jobs labels … --name <name> --label group=… command to tag the current Job. Passing --name keeps the name, because --label replaces every label.
  • Human users see nothing new.
  • Decisions: the hint lives in the CLI output rather than the hf-cli skill, because it's printed right when the agent needs it. Scheduled Jobs aren't covered (they are usually one-off). The group key is only a convention. Nothing is auto-labelled.

Example (agent mode, API mocked)

$ hf jobs run --detach ubuntu ls
id=687f911eaea852de79c4a50a name=ubuntu-ls-3f2a1c url=https://huggingface.co/jobs/lucain/687f911eaea852de79c4a50a
Hint: Job auto-named 'ubuntu-ls-3f2a1c'. Pass `--name` or run `hf jobs labels lucain/687f911eaea852de79c4a50a --name NAME` to rename it.
Hint: If you launch more Jobs in this session, tag them all with `--label group=687f911e` (with a unique `--name` per Job) so they are grouped in the UI. Tag this one too: `hf jobs labels lucain/687f911eaea852de79c4a50a --name ubuntu-ls-3f2a1c --label group=687f911e`.
Hint: Use `hf jobs logs -f lucain/687f911eaea852de79c4a50a` to stream logs, or `hf jobs inspect lucain/687f911eaea852de79c4a50a` to check status.

$ hf jobs run --detach --name lr-1e-4 --label sweep=lr ubuntu ls
Hint: If you launch more Jobs in this session, reuse `--label sweep=lr` (with a unique `--name` per Job) so they are grouped in the UI.

Ran make style, make quality and pytest tests/test_cli.py (411 passed). New tests cover both agent hint variants and check that humans don't get the hint.


Requested by @Wauplin - Slack thread - Agent trace

Requested by @Wauplin (Lucain Pouget) via Moon Bot.
Co-authored-by: Wauplin <Wauplin@users.noreply.github.com>
Slack thread: https://huggingface.slack.com/archives/C04JWPL1S92/p1795181007345349?thread_ts=1795181007.345349&cid=C04JWPL1S92
@bot-ci-comment

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants