Skip to content

fix(cron): cron edit --profile pins job to a profile, not a context switch - #77404

Open
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:fix/cron-profile-pin
Open

andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:fix/cron-profile-pin

Conversation

@andrexibiza

@andrexibiza andrexibiza commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Related #25290 #32045 #32046 #32059 #45335 #45451

What does this PR do?

Fixes hermes cron edit <id> --profile <name> returning "Job not found"
for jobs that clearly exist (#32045, #45335).

Root cause

hermes_cli/main.py:_apply_profile_override pre-parses --profile/-p
from argv and switches HERMES_HOME before any import. But on
cron edit, --profile <name> is the job's profile pin field (the
documented design from #25290) — it does NOT mean "switch the active
profile context". So hermes cron edit <id> --profile trading switched
HERMES_HOME to trading, and cron_edit looked for the job in the WRONG
store → "Job not found", exit non-zero.

The fix (whole class)

  • hermes_cli/main.py_apply_profile_override now exempts
    cron edit's --profile (both --profile X and --profile=X forms),
    mirroring the existing mcp add --args passthrough exception. A bare
    -p before the subcommand (hermes -p coder cron edit ...) still
    switches context, as the operator intends.
  • cron/jobs.pycreate_job/update_job accept and normalize a
    profile field (empty string clears it).
  • hermes_cli/cron.py, hermes_cli/subcommands/cron.py,
    hermes_cli/cli_commands_mixin.py
    — CLI wiring passes --profile
    through to the cron API.
  • tools/cronjob_tools.py — schema exposes profile (create/update).

This is a take-over of #45451 by @coder-xander (cherry-picked,
authorship preserved), conflict-resolved against current main. The
jobs.py hunks were re-applied surgically to avoid reverting main's newer
repeat-limit retention fix.

Addressing existing review commentary

How to test

pytest tests/hermes_cli/test_apply_profile_override.py tests/hermes_cli/test_cron.py tests/cron/test_jobs.py -q
# 80 passed (3 pre-existing TestApplyProfileOverride failures proven via
# stash-test to fail identically on pristine main)

# manual:
hermes cron create --prompt "daily" --schedule "0 9 * * *" --name digest
hermes cron edit digest --profile trading   # was: Job not found
hermes cron list                             # shows Profile: trading

What platforms were tested?

  • Windows 11 native: 80 passed across the three suites, git diff --check
    clean, footgun lint clean.

Why this matters to users

Before: the documented way to pin a cron job to a profile (#25290) was
cron edit --profile, and it was completely broken — "Job not found" on
every invocation, even with a valid job ID. The only workarounds were
hand-editing jobs.json or recreating jobs.

After: cron edit --profile <name> sets the job's profile pin; --profile "" clears it; hermes -p <name> cron ... still operates on another
profile's store. The documented workflow works.

Fixes #32045
Closes #45335

  • Bug fix (non-breaking change that fixes an issue)
  • New feature
  • Breaking change

Checklist

Part of #32046

Part of #45139

…witch

Take-over of NousResearch#45451 (coder-xander): cherry-picked fix, conflict-resolved
against current main, jobs.py profile hunks re-applied surgically to
avoid reverting main's newer repeat-limit retention fix.

- hermes_cli/main.py: _apply_profile_override exempts cron edit's
  --profile (a job field, not the profile-context switch)
- cron/jobs.py: create_job/update_job accept + normalize a profile field
- hermes_cli/cron.py, subcommands/cron.py, cli_commands_mixin.py:
  CLI wiring passes --profile through to the cron API
- tools/cronjob_tools.py: schema exposes profile
- tests: profile-pin regressions (override + CLI e2e); docs updated

Fixes NousResearch#32045.

Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Summary

Eight PRs are associated with this complex. #32059, #45350, #45451, and #77404 address the cron --profile ambiguity; #45231 addresses the separate Copilot ACP <tool_use> failure, while #44918, #60330, and #63381 concern slash/status behavior, cron session continuity, and inference pins respectively.

Related pull requests

Duplicates

#45335 is a duplicate of canonical issue #32045. #45451 is directly superseded by its authorship-preserving takeover #77404; #32059 overlaps their edit pre-parser fix but uniquely covers create/add as well. The slash/status portions of #44918 are duplicated in #45231 and #45350, and #45350 also duplicates #45231's ACP parser.

Suggested consolidation

Keep #77404 open with a salvage path: split out the completed-one-shot and command-guard changes, use closed best-fix #32059 as the tested pre-parser baseline for create/add/edit, and obtain an explicit maintainer decision on persistent per-job routing before retaining the profile field or add the scheduler behavior required to reconcile it with commit d73078e7b's per-profile isolation contract. Close #45451 as duplicate of takeover #77404 despite its keep-open review because the same core diff and authorship are preserved there; leave #32059 as the closed best-fix reference, keep #45350 closed, and triage #44918, #45231, #60330, and #63381 in their separate issue lanes.

Complex graph

flowchart LR
    classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
    classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
    classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
    classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
    classDef best stroke-width:3px,stroke:#b45309
    classDef target stroke-width:3px,stroke:#4338ca
    I32045(["issue #32045 (open)"])
    I32046(["issue #32046 (open)"])
    I45335(["issue #45335 (open)"])
    subgraph Dup32059 ["PRs duplicating each other"]
        P32059["PR #32059 (closed)"]
        P45451["PR #45451 (open)"]
        P77404["PR #77404 (open)"]
    end
    P77404 -.->|partial| I32045
    P77404 -.->|partial| I32046
    P77404 -.->|partial| I45335
    class I32045 open
    class I32046 open
    class I45335 open
    class P32059 closed
    class P45451 open
    class P77404 open
    class P32059 best
    class P32059 best
    class P32059 best
    class P45451 best
    class P45451 best
    class P77404 target
    click I32045 "https://github.com/NousResearch/hermes-agent/issues/32045"
    click I32046 "https://github.com/NousResearch/hermes-agent/issues/32046"
    click I45335 "https://github.com/NousResearch/hermes-agent/issues/45335"
    click P32059 "https://github.com/NousResearch/hermes-agent/pull/32059"
    click P45451 "https://github.com/NousResearch/hermes-agent/pull/45451"
    click P77404 "https://github.com/NousResearch/hermes-agent/pull/77404"
Loading

Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).

Cross-PR triage: Reviewed 8 pull requests and 4 issues in this complex. Each diff was read against this issue; Assessment working set: 189 kB of PR diffs, 37 kB of issue/PR text, 22 kB of discussion (28 comments), 19 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

@andrexibiza

Copy link
Copy Markdown
Contributor Author

Acknowledged the eight-PR complex map. #77404 is the narrow fix for the cron edit --profile context-switch bug: pinning the profile so edit does not switch context, with the argv regression coverage. #32059 is the recorded best-fix reference for the broader _apply_profile_override consumption; where this PR overlaps, it targets the edit-path ambiguity directly and stays mergeable against current main. Keeping the two scopes separate per the complex structure.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

3 participants