You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(plugins): apply plugin task bindings and lifecycle changes live - #3611
Related issue: #3551
Validation tasks: changes #1224 C1
Plugin tasks register only when an API server starts. Turning a plugin task on or off, changing
its binding trigger, and installing, enabling, disabling, updating or removing a plugin all wait
for every API server to restart, and each binding write answers restart_required: true. An
administrator who installs a plugin with a scheduled task doesn't see the task until a restart.
This change applies those changes on every API server within seconds, without a restart.
Approach
plugins.TaskRegistry.Sync compares the database with the task manager: it registers new
tasks, unregisters disabled or removed ones, updates names and default schedules in place, and
reloads schedules. It never writes a schedule; the "saved schedule, else binding trigger, else
manifest default, else startup" rule from feat(plugins): run plugin tasks on their manifest default schedule #3551 is unchanged.
Each API server syncs before a lifecycle change or binding write it handles returns, on every plugins_changed or new plugin_tasks_changed event, and every minute as a backstop (10 seconds
after a failed sync). Binding writes publish only plugin_tasks_changed, so proxy nodes and
event dispatchers don't rebuild on them.
The task manager can register after Start and unregister. Unregistering retires the worker:
its triggers stop, a run in progress is canceled, and a firing or manual run that found the
worker before it was retired is refused. ReloadSchedule installs a task's schedule when it
differs from the one it runs.
Reload compares triggers by the fields each type reads. task_schedules keeps day_of_week
only on weekly triggers, so before this a daily trigger carrying a weekday looked changed on
every reload and restarted its timer.
Both binding PUTs (v2 and frozen v1) share the apply path and answer restart_required: false;
it is true only on a server with no task manager. The plugin page says on/off applies right
away.
Validation
Touched Go packages (internal/plugins, internal/taskmanager/..., internal/apiv2 plugin and task routes, internal/api/handlers plugin and task routes), with the race detector on the registry and task manager: pass.
make lint-changed, the OpenAPI, contract, web types, route inventory, migration ledger and local-path checks: pass.
Web: prettier and the plugin helper and plugin admin component tests: pass.
A trial merge with the stacked single-run branch builds and passes the same Go tests after two small conflicts in the trigger loop and the architecture doc.
Shared dev, on a build that combines this branch with the single-run change and the other plugin
notification changes, using a QA plugin with two 1-minute default tasks: both appeared on the
Tasks page right after install, with no restart, and ran every minute. Changing one to every 2
minutes on the task page applied at once. The plugin page's switch stopped and restarted a task
live, and its binding kept an empty trigger. Upgrading the plugin to a 3-minute default moved
the task still on the default and left the other on its 2-minute admin schedule.
The page shows a plugin task applied live on shared dev: it appears after install without a restart,
a task-page schedule change and the plugin-page switch take effect at once, and an upgrade moves a
task still on the default to the new default while an admin schedule stays.
Risks
Task registration changes at runtime on every API server; a bug here could leave a task
unscheduled until the next one-minute sync.
A task installed or enabled at runtime whose schedule is "at startup" runs once a few seconds
after it registers, as at a server start. With the single-run pull request, that run happens
on one server.
Core tasks still pick up a schedule edited on another server only after a restart; plugin tasks
pick it up within a minute.
Adversarial review: Codex (gpt-6.1-sol) reviewed the multi-server sync, restart durability and
run cancellation when this code was part of feat(plugins): run plugin tasks on their manifest default schedule #3551; a retired worker that could still run a
firing it had taken and tasks registering on the wrong schedule were fixed then. A later
four-agent Claude review found the day_of_week reload mismatch, fixed here.
Apply plugin task bindings and lifecycle changes live via task registry sync
Adds a TaskRegistry sync loop that reconciles plugin scheduled tasks with enabled installations and bindings: registers new tasks, reloads schedules on trigger changes, and removes disabled or deleted tasks. Servers sync at startup, after local binding or plugin lifecycle changes, on plugin_tasks_changed events from other API servers, and periodically with retries.
Extends taskmanager.TaskManager with RegisterLive, Unregister, and ReloadSchedule so tasks can be managed after Start. Tasks implementing the new DefaultFollowingTask interface run their current default triggers without persisting them until an admin saves a schedule.
Trigger selection now prefers a valid binding trigger, then the manifest default, then startup. Invalid or unsupported binding triggers are ignored instead of forced to startup. The admin API reports default_schedule on scheduled-task capabilities, and task-binding responses report an accurate restart_required.
Risk: SetAdminPluginTaskBinding now returns (bool, error) instead of error — check implementations of the AdminPluginConfigurationService interface. The triggerLoop rework fixes a bug where a trigger update alone started a run; check worker.go generation handling for regressions.
Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).
No actionable comments were generated in the recent review.
Walkthrough
Plugin tasks now synchronize with installation and binding changes while API servers are running. The task manager supports live registration, schedule reloads, and worker retirement. Task-binding responses report whether a restart is required.
The task manager can register, replace, unregister, and reload tasks after startup. Retired workers stop triggers and cancel active runs. Tests cover live registration, unregistering, saved schedules, and schedule reloads.
The registry reconciles eligible plugin tasks and schedules with installations and bindings. Startup, local changes, cache events, and periodic runs trigger syncs; failed syncs are retried. Tests cover binding changes, saved schedules, read failures, and retry timing.
Task-binding API and response behavior internal/api/handlers/plugins.go, internal/api/router.go, internal/apiv2/admin_plugin_configuration.go, contracts/api/v2/openapi.json, docs/admin-api.md, web/src/api/v2/schema.ts
Task-binding writes invoke the configured synchronization callback. The API returns whether a restart is required, and API descriptions document when bindings apply without a restart.
Silo-Server/silo-server#4073 — The issue describes a saved schedule that does not run on its first firing. This change updates schedule reload and trigger-generation handling, but the issue notes that confirmation after merge is still needed.
Possibly related PRs
Silo-Server/silo-server#3551 — This PR establishes task schedule precedence that the live registry must preserve when it applies binding and manifest schedule changes.
Plugin task bindings and lifecycle changes now apply to running API servers, with retries after failed syncs and conditional restart reporting. No unresolved merge-blocking issue was found in the reviewed changes.
Security architecture risk: Low · up to 22efd
Administrator access controls remain in place. However, disabling and quickly re-enabling a task can admit another run before the previous execution finishes cancelling, weakening local execution ownership. No new privilege escalation or cross-tenant access was established.
Retained concerns
Medium · reliability · inferred: Rapid disable/re-enable can release a task key before its previous execution terminates. Unregister deletes the mapped worker and only signals cancellation; RegisterLive creates a fresh worker whose reservation state does not include the retiring execution. A new manual or scheduled run can therefore overlap a slow-to-unwind execution, while cancellation by key addresses only the replacement. This weakens process-local execution containment and ownership; it is not a claim that tasks previously had cluster-wide exclusivity.
Security review details
Security Blast Radius
inferred — An authorized binding change affects the selected installation and capability on every participating API server after successful reconciliation. The retained ownership concern is process-local and task-key-specific; no expansion to other tenants, environments, credentials, or infrastructure authority was established.
Trust Boundaries and Controls
observed — Administrator-controlled binding data is persisted before live effects occur. Peer events are reconciliation hints rather than authority-bearing commands, and the scan independently restricts registrations to eligible installation capabilities.
Resilience and Maintainability Implications
observed — Retirement stops triggers and makes stale worker reservations fail. These controls prevent new reservations on the retired object, but do not retain task-key ownership until its active execution finishes; a replacement has independent state.
Hardening Proposals
proposed — Retain a task-key-level execution reservation across worker generations until the retiring execution completes, or defer replacement execution until draining finishes. This would preserve local ownership without requiring a cluster-wide singleton scheduler.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(plugins): apply plugin task bindings and lifecycle changes live" matches the main change in the changeset. The raw summary shows a live TaskRegistry sync, task-manager registration aft…
Description check
The description states the problem (plugin tasks register only at API server startup and binding writes return restart_required true) and the approach (TaskRegistry.Sync, per-server syncs, plugin_task…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat(plugins): apply plugin task bindings and lifecycle changes live" matches the main change in the changeset. The raw summary shows a live TaskRegistry sync, task-manager registration after Start, binding-change callbacks, and restart_required now false when a task manager is present. The title is specific and uses a conventional commit prefix.
Full details: Description check
Explanation
The description states the problem (plugin tasks register only at API server startup and binding writes return restart_required true) and the approach (TaskRegistry.Sync, per-server syncs, plugin_tasks_changed event, task manager retirement and reload). It also lists validation, risks, and evidence. It matches the changeset closely.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: af00aafa-c0bf-4f47-b54e-287a588c63d1
Commits
Reviewing files that changed from the base of the PR and between f2c7731 and 22efdd2.
Files selected for processing: 15
cmd/silo/main.go
contracts/api/v2/openapi.json
docs/admin-api.md
docs/admin-tasks-api.md
docs/architecture/plugin-scheduled-tasks.md
internal/api/handlers/plugins.go
internal/api/router.go
internal/apiv2/admin_plugin_configuration.go
internal/cache/redis.go
internal/plugins/task_registry.go
internal/plugins/task_registry_test.go
internal/taskmanager/manager.go
internal/taskmanager/manager_test.go
internal/taskmanager/worker.go
web/src/api/v2/schema.ts
Files skipped from review as they are similar to previous changes: 1
docs/admin-tasks-api.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Clear the change flag when reloading an unscheduled task
When a plugin task has an explicitly empty schedule on this replica and another server saves a nonempty schedule, this reload calls setTriggers with notify=true. The waiting triggerLoop consumes triggerUpdate in its zero-trigger branch without clearing triggerChanged; consequently, the first real firing only clears that flag and skips execution. The production triggers are one-shot until rearmed, so the task then remains unscheduled indefinitely, and subsequent registry syncs cannot recover it because runsSchedule already reports a match. Clear the change flag when consuming the update in the zero-trigger branch so remotely re-enabled schedules actually run.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 54d188c, with a synctest regression test (TestReloadScheduleRunsTaskThatHadNoTriggers) that fails without the fix. While testing I found the reverse case: two quick updates made the loop treat the second update signal as a firing and run the task unscheduled. 3b38461 replaces the change flag with a trigger generation count. An update now only wakes the loop, and a firing runs the task only if it came from the triggers the loop is waiting on.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 3a1f3fa3-91a0-491b-8833-e59f3d9fd260
Commits
Reviewing files that changed from the base of the PR and between 101e626 and f2c7731.
Files selected for processing: 7
docs/architecture/plugin-scheduled-tasks.md
internal/plugins/task_registry.go
internal/plugins/task_registry_test.go
internal/taskmanager/manager.go
internal/taskmanager/manager_test.go
internal/taskmanager/worker.go
internal/taskmanager/worker_test.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…long for a timer
The schedule cleanup deleted any plugin task schedule holding one startup
trigger, including one an administrator saved after the seed. A seed
leaves revision 2 at most, so higher revisions now stay.
An interval above what a time.Duration holds overflowed into a timer
that fired at once; such a trigger is no longer runnable.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Base automatically changed from
feat/plugin-task-default-schedule to
mainNovember 18, 2026 19:27
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
enhancementNew feature or requestpriority: P2Limited scope, workaround exists, or polishsize/XXL1000–2999 added + deleted lines (all files); change volume, not priority.stackedBase is another open PR; merge in stack order named in the body
1 participant
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.
Problem
Related issue: #3551
Validation tasks: changes #1224 C1
Plugin tasks register only when an API server starts. Turning a plugin task on or off, changing
its binding trigger, and installing, enabling, disabling, updating or removing a plugin all wait
for every API server to restart, and each binding write answers
restart_required: true. Anadministrator who installs a plugin with a scheduled task doesn't see the task until a restart.
This change applies those changes on every API server within seconds, without a restart.
Approach
plugins.TaskRegistry.Synccompares the database with the task manager: it registers newtasks, unregisters disabled or removed ones, updates names and default schedules in place, and
reloads schedules. It never writes a schedule; the "saved schedule, else binding trigger, else
manifest default, else startup" rule from feat(plugins): run plugin tasks on their manifest default schedule #3551 is unchanged.
plugins_changedor newplugin_tasks_changedevent, and every minute as a backstop (10 secondsafter a failed sync). Binding writes publish only
plugin_tasks_changed, so proxy nodes andevent dispatchers don't rebuild on them.
Startand unregister. Unregistering retires the worker:its triggers stop, a run in progress is canceled, and a firing or manual run that found the
worker before it was retired is refused.
ReloadScheduleinstalls a task's schedule when itdiffers from the one it runs.
task_scheduleskeepsday_of_weekonly on weekly triggers, so before this a daily trigger carrying a weekday looked changed on
every reload and restarted its timer.
restart_required: false;it is true only on a server with no task manager. The plugin page says on/off applies right
away.
Validation
internal/plugins,internal/taskmanager/...,internal/apiv2plugin and task routes,internal/api/handlersplugin and task routes), with the race detector on the registry and task manager: pass.make lint-changed, the OpenAPI, contract, web types, route inventory, migration ledger and local-path checks: pass.notification changes, using a QA plugin with two 1-minute default tasks: both appeared on the
Tasks page right after install, with no restart, and ran every minute. Changing one to every 2
minutes on the task page applied at once. The plugin page's switch stopped and restarted a task
live, and its binding kept an empty trigger. Upgrading the plugin to a 3-minute default moved
the task still on the default and left the other on its 2-minute admin schedule.
Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3611/
The page shows a plugin task applied live on shared dev: it appears after install without a restart,
a task-page schedule change and the plugin-page switch take effect at once, and an upgrade moves a
task still on the default to the new default while an admin schedule stays.
Risks
unscheduled until the next one-minute sync.
after it registers, as at a server start. With the single-run pull request, that run happens
on one server.
pick it up within a minute.
failure doesn't fail the install.
Checklist
AI Disclosure
run cancellation when this code was part of feat(plugins): run plugin tasks on their manifest default schedule #3551; a retired worker that could still run a
firing it had taken and tasks registering on the wrong schedule were fixed then. A later
four-agent Claude review found the
day_of_weekreload mismatch, fixed here.🤖 Generated with Claude Code
Note
Apply plugin task bindings and lifecycle changes live via task registry sync
TaskRegistrysync loop that reconciles plugin scheduled tasks with enabled installations and bindings: registers new tasks, reloads schedules on trigger changes, and removes disabled or deleted tasks. Servers sync at startup, after local binding or plugin lifecycle changes, onplugin_tasks_changedevents from other API servers, and periodically with retries.taskmanager.TaskManagerwithRegisterLive,Unregister, andReloadScheduleso tasks can be managed afterStart. Tasks implementing the newDefaultFollowingTaskinterface run their current default triggers without persisting them until an admin saves a schedule.default_scheduleon scheduled-task capabilities, and task-binding responses report an accuraterestart_required.SetAdminPluginTaskBindingnow returns(bool, error)instead oferror— check implementations of theAdminPluginConfigurationServiceinterface. ThetriggerLooprework fixes a bug where a trigger update alone started a run; check worker.go generation handling for regressions.Macroscope summarized 89edbb1.