feat(cron): cron jobs leave the core for the cron-jobs plugin #37
Closed
gabrielvidal
wants to merge 0 commits from
cron-jobs-plugin into main
pull from: cron-jobs-plugin
merge into: gabrielvidal:main
gabrielvidal:main
gabrielvidal:fresh-context-plugin
gabrielvidal:remove-hooks-page
gabrielvidal:palette-plugins
gabrielvidal:linear-projects
gabrielvidal:agent-messaging
gabrielvidal:model-router
gabrielvidal:conv-card-layout
gabrielvidal:ask-more-options
gabrielvidal:agent-limits
gabrielvidal:generic-ui-strings
gabrielvidal:android-push-bridge
gabrielvidal:auto-translate
gabrielvidal:filter-chips
gabrielvidal:plugin-catalog
gabrielvidal:file-viewers
gabrielvidal:plugins-page-rework
gabrielvidal:hub-mcp-plugin
gabrielvidal:translation-plugin
gabrielvidal:scheduled-doors
gabrielvidal:context-skills-plugin
gabrielvidal:files-plugins
gabrielvidal:worker-names
gabrielvidal:details-panel-perf
gabrielvidal:services-plugin-only
gabrielvidal:fix-test-env-leaks
gabrielvidal:bg-shells-plugin
gabrielvidal:feat-commits-plugins
gabrielvidal:fix-branch-line-tag-rows
gabrielvidal:retire-dead-leftovers
gabrielvidal:runner-into-harness-pi
gabrielvidal:retire-tool-proxy
gabrielvidal:new-project-policy-plugin-only
gabrielvidal:guest-jobs-sonnet
gabrielvidal:push-buttons-everywhere
gabrielvidal:mail-send-plugin
gabrielvidal:ui-polish-batch
gabrielvidal:command-palette-plugin
gabrielvidal:keyboard-shortcuts-plugin
gabrielvidal:prompt-shortcuts-plugin
gabrielvidal:matomo-site-grants
gabrielvidal:lab-chrome-plugin
gabrielvidal:performance-plugin
gabrielvidal:whats-new-plugin
gabrielvidal:skills-agents-plugin
gabrielvidal:goals-plugin-only
gabrielvidal:storage-server-side
gabrielvidal:plugin-scheduled-conversations
gabrielvidal:plugin-fences
gabrielvidal:handoff-plugin
gabrielvidal:plugin-commands
gabrielvidal:plugin-speed
gabrielvidal:cleanup-provider-harness
gabrielvidal:plugin-conversation-labels
gabrielvidal:plugin-plan-usage
gabrielvidal:fix-worker-harness-sync
gabrielvidal:plugin-gcloud-reauth
gabrielvidal:feat/plugin-cards-in-thread
gabrielvidal:feat/plugin-proxy-wake
gabrielvidal:unify-subagents-children
gabrielvidal:wave3d-frontend-typed-plugins
gabrielvidal:wave3c-sidecar-strict-plugins
gabrielvidal:wave3a-catalog-accounts-profiles
gabrielvidal:wave3b-pricing-usage-cutover
gabrielvidal:wave1a-typed-plugins
gabrielvidal:wave1b-sidecar-runtime
gabrielvidal:fix-ios-overlay-scroll
gabrielvidal:batch2-work-resources-core
gabrielvidal:batch2-apikeys
gabrielvidal:plugin-blue-green-deploy
gabrielvidal:plugin-ship
gabrielvidal:plugin-project-env
gabrielvidal:plugin-memories
gabrielvidal:plugin-activity
gabrielvidal:plugin-templates
gabrielvidal:plugin-desk-phone
gabrielvidal:batch1-platform
gabrielvidal:plugins-list-view
gabrielvidal:dash-plugins
gabrielvidal:pets-plugin
gabrielvidal:ha-push-channel
gabrielvidal:mail-agents
gabrielvidal:graph-fix
gabrielvidal:graph-plugin
gabrielvidal:services-plugin
gabrielvidal:left-to-do-plugin
gabrielvidal:plugins-gallery
gabrielvidal:home-conv-menu
gabrielvidal:meta-business
gabrielvidal:agy-rdrand
gabrielvidal:bg-lag
gabrielvidal:conv-load-perf
gabrielvidal:askform-instant
gabrielvidal:fix/drawer-menu-done-chip
gabrielvidal:pi-midrun-compaction
gabrielvidal:interrupt-menu-btn
gabrielvidal:authz
gabrielvidal:inkling
gabrielvidal:repo-plugins
gabrielvidal:work-sync
gabrielvidal:leftovers
gabrielvidal:fix/agy-guest-guard
gabrielvidal:feat/model-presets
gabrielvidal:scroll-back
gabrielvidal:feedback-bell
gabrielvidal:feat/movies-tool
gabrielvidal:feat/running-thread-padding
gabrielvidal:feat/drawer-filter-button-card-chat
gabrielvidal:burn-rate
gabrielvidal:guest-install
gabrielvidal:guest-usage
gabrielvidal:guest-palette
gabrielvidal:guest-form-links
gabrielvidal:form-open-buttons
gabrielvidal:clarifier-lean
gabrielvidal:auto-archive
gabrielvidal:guests-profile
gabrielvidal:conv-motion
gabrielvidal:share-target
gabrielvidal:terminal-sync
gabrielvidal:work-context-past
gabrielvidal:work-context-brief
gabrielvidal:enroll-codes
gabrielvidal:open-image-file
gabrielvidal:worker-uploads
gabrielvidal:conv-drawer-search
gabrielvidal:stack-motion-v3
gabrielvidal:notif-stack-fixes
gabrielvidal:home-motion
gabrielvidal:i18n-fr
gabrielvidal:local-electricity-cost
gabrielvidal:cache-pill-thread
gabrielvidal:cache-scenarios
gabrielvidal:fresh-start
gabrielvidal:msg-select
gabrielvidal:shortcuts-setup
gabrielvidal:ui-0-40-3
gabrielvidal:outbox-landing
gabrielvidal:resume-scope
gabrielvidal:conv-filter-range
gabrielvidal:fix-subagent-form-session
gabrielvidal:ask-form-integration
gabrielvidal:form-visual-options
gabrielvidal:watcher-perf
gabrielvidal:last-msg-summary
gabrielvidal:secret-fields
gabrielvidal:commit-review
gabrielvidal:summary-mode-fixes
gabrielvidal:service-tag-parser
gabrielvidal:clarifier
gabrielvidal:fetch-diet-2
gabrielvidal:fetch-diet
gabrielvidal:conv-look
gabrielvidal:pwa-links
gabrielvidal:tool-widgets
gabrielvidal:worker-autoupdate
gabrielvidal:usage-rings
gabrielvidal:opencode-harness
gabrielvidal:notif-diet
gabrielvidal:conv-resources
gabrielvidal:scheduled-tasks
gabrielvidal:profiles
gabrielvidal:notify-exact-cost
gabrielvidal:usage-measuring
gabrielvidal:guest-projects
gabrielvidal:usage-calibration
gabrielvidal:account-switch
gabrielvidal:multiuser-improve
gabrielvidal:form-groups
gabrielvidal:multiuser
gabrielvidal:motion-reel
gabrielvidal:dashboards-fixes
gabrielvidal:split-big-files
gabrielvidal:held-regex
gabrielvidal:subagent-interrupts
gabrielvidal:form-html
gabrielvidal:tokunia-video
gabrielvidal:settings-uniform
gabrielvidal:worker-ask-fix
gabrielvidal:worker-generic-mac
gabrielvidal:runner-shortcuts
gabrielvidal:notify-unify
gabrielvidal:perf-list-cache
gabrielvidal:mac-worker
gabrielvidal:model-switch
gabrielvidal:pipeline-paths
gabrielvidal:multi-account
gabrielvidal:feature-flags
gabrielvidal:qwen38-support
gabrielvidal:url-prompt
gabrielvidal:running-pages
gabrielvidal:homelab-tag
gabrielvidal:root-project
gabrielvidal:or-models
gabrielvidal:deploying-loader
gabrielvidal:worktree-diff
gabrielvidal:conv-tags
gabrielvidal:tags-page
gabrielvidal:agents-page
gabrielvidal:icon-picker-shortcuts
gabrielvidal:conv-cta
gabrielvidal:stamp-refine
gabrielvidal:post-task-cache
gabrielvidal:post-tidy-completed
gabrielvidal:form-badge
gabrielvidal:hooks-delay-seconds
gabrielvidal:cost-dashboard
gabrielvidal:plan-forms
gabrielvidal:form-mobile
gabrielvidal:guidelines-dag
gabrielvidal:skills-view
gabrielvidal:navbar-hold
gabrielvidal:spawnbox-status
gabrielvidal:hold-editable-expand
gabrielvidal:drawer-transparent
gabrielvidal:hold-fix
gabrielvidal:hold-editable
gabrielvidal:charroll-bump
No Reviewers
Labels
No items
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
gabrielvidal (Gabriel Vidal)
Clear assignees
No Assignees
gabrielvidal
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gabrielvidal/ai-agent#37
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Cron jobs — the owner's and every guest's own « Tâches planifiées » — leave the core for the new
cron-jobslive plugin (ai-agent-plugins PR, linked below). The core keeps only thin contracts: a guest's job run as that guest, confined by the core (runs.guest), themeta.cronstamp, the delivery of a guest job's result, « Discuter », and theruns.cronprovider readers (budget, auto-archive, agents). Decisions from Gabriel's formsmove-ai-agent-cron-jobs-into-a-plugin_u0wa6bandcron-scheduled-in-the-cli-and-mcp_x4nk83.Key changes
backend/cron/(scheduler, service, routes, guests, guest_routes),schemas/cron.py,deps.cron_store/cron_scheduler,/api/cron*,/api/me/cron*,guestDefaults.cronLimits,cli/skills/scheduled-jobs, MCPrun_cron_job/set_cron_job/browse kind=cron;ai-agent cronnow only points atai-agent plugin cron-jobs …(exit 2). Frontend: Settings → Cron (CronJobs.tsx),business/jobs/*,GuestJobs.tsx, the cron limits inGuestDefaults.tsx, thecronSSE event,/api/cronmocks.runs.guestbridge (plugins/hubruns.py→ newruns/guestjob.py):POST …/hub/runs/guest {guest, prompt, model, job, project, email, mailHtml, allow, effort, probe}. Owner-only, operator capability. The core builds the scope, the lean allowlist, the budget and the EVOX2 probe / Sonnet fallback from the guest's record; a body'sscope/cwd/leanis ignored. It stampsmeta.cron {id, name, guest, firedAt, project, email, mailHtml, plugin, fallback?}.runs.starttakescron: {id, name}and stampsmeta.cron(owner jobs).runs/guestjob.deliver_sweep, a push and an optional mail rendered from amailHtmlpage) reads the stamp, not a store.POST /api/cron-runs/discuss {sessionId, prompt}(cron.own, guests only).DiscussBarmoved tobusiness/conversations/components/. The Discuter scope andaccess.can_sendare read offmeta.cronChat/meta.cron.plugins/cron_bridge.py: theruns.cronprovider'sindex/list/get/createops, cached 30 s and refreshed off-thread. It feedsusage/budget.py,conversations/autoarchive.py,agents/runs.py,conversations/catalog.py, the agents page's "its cron job", andhubcatalog's Schedule.core/cronexpr.py(the matcher: plugin scheduler, manifest, budget) andagents/runconfig.py(agent frontmatter: Run now,runs.start'slean).ui.pages[].unless: a page hidden from whoever holds a permission.context.writecreate: true, which only makes a new.claude/agents/<name>.md.provides: runs.cron.setRoutestays under/settings/p/…. This was a bug: it remounted under/plugins/…in the wrong section.carryover.cron_jobs):/data/cron-jobs.json→ the plugin'sjobs.json(history unchanged),guestDefaults.cronLimits→limits.json, guests'qwenjobs →sonnet. It runs once, needs no install, and leaves the legacy file as.migrated./settings/cron→/settings/p/cron-jobs/jobsand/settings/jobs→/settings/p/cron-jobs/mine, keeping the query string and hash. Saved drawer and panel layouts are renamed in place.matrix.golden.txt, telemetryfeatures.json, i18n, mocks,openapi.json+src/generated, CLAUDE.md, docs/plugins.md / mcp.md / settings.md.Key decisions
mailHtmlpage and inline images, realpath-contained) and to mail them. No plugin bridge gives either power, and adding one would be broader than keeping ~300 lines. It needs nothing from the plugin because everything it reads rides on the run'smeta.cronstamp. A run fired before the move (noemailon its stamp) asks the plugin'sgetonce.cronChat.project, else the run's project tag for old runs).jobs/fire.py(its own session, no inherited pipes), so one sleeping box never holds the minute. The probe itself is the bridge's (runs.start'sfallback,runs.guest'sprobe).flock+ compare-and-set), as the core store did. The scheduler's in-memory_firedset can't protect the blue-green window.limits.json→ 5 / sonnet. The settings fields have no default, so the carried values aren't hidden behind one.cron.ownis kept, but only for « Discuter ». Access to the jobs themselves is the managed grant (defaultForGuests: true) plusplugins.use. A worker-bound connection has noplugins.use, so no cron there, as decided.ai-agent cronprints where the commands went (exit 2), likeservices. It is not an alias.guest-jobs-sonnet) is superseded: its decision (guest jobs default to Sonnet, existingqwenones move once) is carried byruns/guestjob.DEFAULT_MODELand the carry-over, which skips the move if #23's own marker shows it already ran.For the
hub-mcp-pluginbranches when they rebase~/worktrees/ai-agent-hub-mcp-plugin:cli/ai_agent.py(the oldcmd_cron,cron_expr,_guest_job_fields, thecronparser and itsGUEST_COMMANDSentry) andcli/test_ai_agent.pyCronMailHtmlmust take this branch's version.~/worktrees/ai-agent-plugins-hub-mcp(plugins/hub-mcp) has to drop:handlers/hubmcp_tools.py:run_cron_jobandset_cron_job,"cron"inBROWSE_KINDS, and thekind == "cron"branch of_rows. Thebrowsedescription must also stop saying "cron jobs".handlers/hubmcp_server.py: "cron jobs" in the instructions.README.md: the agents row's cron tools.test_hub_mcp_tools.py(agents group set, theGET /api/cronguest test) andtest_hub_mcp_endpoint.py(run_cron_job,set_cron_job,browse kind=cron).scheduled-doorsbranch also touchescli/mcp_tools.py/BROWSE_KINDS; after either rebase, regeneratefrontend/openapi.json,src/generatedandauthz/matrix.golden.txt.Changelog
plugin_cron-jobs_ls,_run,_pause…) and a CLI command (ai-agent plugin cron-jobs …), for guests on their own jobs tooai-agent cron,/api/cron,/api/me/cronand therun_cron_job/set_cron_jobMCP toolsInstall order
Merge and deploy this PR first, then the ai-agent-plugins PR. The plugin is
seed: true: the hub installs it from the seed dir at the next start, and its carry-over has already putjobs.jsonandlimits.jsonin its shared dir. Until the plugin is installed and approved, no cron job fires, so keep the two deploys close together. Then the homelab PR: its agents pause themselves withai-agent plugin cron-jobs pause ….Test notes
test_mcp(number matching) fails on main too.test_typed_plugins(test_records_carry_kind) fails only because the worktree path is under~/worktrees, which the store remaps; it passes from/tmpand on main.test_guest_jobs.py(24: confinement,runs.guestand its gate, theruns.startcron stamp, Discuss, delivery,mailHtml) andtest_cron_bridge.py(11: readers, carry-over,context.writecreate,unless). Also updated:test_worker_routing,test_usage_budget,test_autoarchive,test_plugin_catalog,test_guests,test_authz,test_i18n,test_cron_lean,cli/test_mcp_tools,cli/test_ai_agent.tscclean; vitest 1103/1104 (FreshContextCacheExpiredNoticefails on main too)./data/cron-jobs.jsonwith an owner job and a guest'sqwenjob, the plugin seeded from the plugins worktree):.migrated, the guest job moved to sonnet, andlimits.jsonholds{maxJobs: 3, defaultModel: sonnet}.ai-agent plugin cron-jobs ls|show|run|pause|resumework, andai-agent cronprints the pointer.runs.start; there is no sidecar here, so the refusal was recorded aslastStatus.listreturns their own jobs, and a*/15schedule is refused./api/plugins/ui: the owner seesjobsonly, the guestmineonly./settings/cronredirects. The screenshots below were taken after the last fix.ai-agent-deploy).🤖 Generated with Claude Code
Screenshots
Merged into
mainas16e3b2e9by the auto-ship batch https://ai-agent.lab.gabvdl.xyz/conversation/01a22324-ffa9-78f0-999d-dff18a148ad0.Pull request closed