fix(cron): cron edit --profile pins job to a profile, not a context switch - #77404
andrexibiza wants to merge 1 commit into
Conversation
…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>
SummaryEight PRs are associated with this complex. #32059, #45350, #45451, and #77404 address the cron 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 consolidationKeep #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 Complex graphflowchart 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"
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. |
|
Acknowledged the eight-PR complex map. #77404 is the narrow fix for the |
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_overridepre-parses--profile/-pfrom argv and switches
HERMES_HOMEbefore any import. But oncron edit,--profile <name>is the job's profile pin field (thedocumented design from #25290) — it does NOT mean "switch the active
profile context". So
hermes cron edit <id> --profile tradingswitchedHERMES_HOME to
trading, andcron_editlooked for the job in the WRONGstore → "Job not found", exit non-zero.
The fix (whole class)
hermes_cli/main.py—_apply_profile_overridenow exemptscron edit's--profile(both--profile Xand--profile=Xforms),mirroring the existing
mcp add --argspassthrough exception. A bare-pbefore the subcommand (hermes -p coder cron edit ...) stillswitches context, as the operator intends.
cron/jobs.py—create_job/update_jobaccept and normalize aprofilefield (empty string clears it).hermes_cli/cron.py,hermes_cli/subcommands/cron.py,hermes_cli/cli_commands_mixin.py— CLI wiring passes--profilethrough to the cron API.
tools/cronjob_tools.py— schema exposesprofile(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
hermes cron edit <id> --profile <name>returns "Job not found" for existing jobs #32045): "Related to [Bug]hermes cron create --profile <name>switches HERMES_HOME instead of pinning — cron lands in target profile's jobs.json #32046... Root cause is likelyshared:
--profileswitchesHERMES_HOMEat CLI [level]." → Exactlyright, and that is the root cause fixed here (the exemption in
_apply_profile_override).but only fix(cli): keep --profile flag on cron create|add|edit subparser (#32046) #32059 and fix(cron):
hermes cron edit --profile <name>now sets job profile field #45451 implement the [fix]." → This PR shipsfix(cron):
hermes cron edit --profile <name>now sets job profile field #45451's implementation, rebased on current main, with regressions anddocs — and the jobs.py hunks surgically re-applied so nothing newer on
main regresses.
cron edit --profile" — that path nowworks.
How to test
What platforms were tested?
git diff --checkclean, 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" onevery 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 anotherprofile's store. The documented workflow works.
Fixes #32045
Closes #45335
Checklist
git diff --checkcleanhermes cron edit --profile <name>now sets job profile field #45451 by @coder-xander, cherry-picked with authorship preservedPart of #32046
Part of #45139