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): run plugin tasks on their manifest default schedule - #3551
Related issue: N/A
Validation tasks: none (this no longer touches plugin install or update, so #1224 C1 is unaffected; the live task sync that did is now in feat/plugin-task-live-apply)
A plugin's scheduled task with no binding runs once at each server start, whatever schedule its
plugin needs. SDK scheduled_task.default_trigger lets a manifest declare one, but the server
ignores it. Two kinds of stored row would also hide it on existing servers: the admin plugin
page's on/off switch stored {"type":"startup"} as the binding trigger, and the task manager
saved every plugin task's first default (startup) as its schedule.
This change runs plugin tasks on their manifest default and clears those rows. Live apply of
binding and plugin changes, and running each firing on one API server, are split into stacked
pull requests on top of this one.
Approach
A plugin task runs the first of: a schedule saved on its task page, its binding trigger, the
manifest's default_trigger, one run at startup. A trigger the task manager can't run falls
through to the next source. Binding and manifest triggers keep only the fields their type reads.
The task manager never saves a plugin task's default (new taskmanager.DefaultFollowingTask).
A saved schedule therefore always means an administrator's edit, and a new manifest default or
binding trigger reaches every other task at the next server start. The task schedule GET
answers the default at revision zero; the first PUT saves a schedule.
Migration plugin_tasks_follow_manifest_default resets binding triggers equal to {"type":"startup"} to {} and deletes plugin task schedules that are exactly one startup
trigger and were never edited (revision 2 or lower, which is where a seed leaves one), unless
the binding sets an interval, daily or weekly trigger (then the startup schedule was an edit).
An interval longer than a timer can hold is not runnable and falls through like any other
trigger the task manager can't run. The plugin page's switch now resends only a trigger set through the API.
The v2 admin plugin capability reports default_schedule, and the plugin page shows it for a
task with no binding trigger. Binding writes still answer restart_required: true.
An earlier revision of this pull request saved schedules on binding writes and moved saved
schedules that still equaled the old default on plugin updates. The rule above replaces both.
Touched Go packages (internal/plugins, internal/taskmanager/..., internal/apiv2 plugin and task routes, internal/api/handlers plugin and task routes): pass.
Migration run against a scratch database seeded with legacy binding triggers, seeded and edited schedules, an empty schedule and a core task's schedule: only the legacy trigger and the two seeded startup schedules changed.
make lint-changed, the OpenAPI, contract, web types, route inventory, migration ledger and local-path checks: pass.
Web: typecheck, prettier, eslint and the plugin helper tests: pass.
Not yet run on shared dev for this narrowed branch.
An administrator who saved exactly "at startup" on a plugin task's page before schedule
revisions existed (September) can't be told apart from a seeded schedule, so the migration
clears it. That task then follows its binding and manifest default; until its plugin declares
a default, that is still one startup run. A startup schedule saved since then is kept.
There is no way to go back to following the default after a task-page edit, other than
deleting the saved schedule row.
Every API server still runs each plugin task firing; the stacked single-run pull request fixes
that.
Pins silo-plugin-sdk v0.33.0, the release that carries the SDK side of this change.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or says there is none.
AI Disclosure
Harness: Claude Code, run from T3 Code
Tool(s): Claude Code (implementation); Codex CLI (independent review)
Adversarial review: Codex (gpt-6.1-sol) reviewed the earlier revision's multi-server scheduling,
restart durability and run cancellation. A later four-agent Claude review found that every API
server ran each firing, that switch-written {"type":"startup"} binding triggers outranked the
manifest default, and that a daily trigger carrying day_of_week looked changed on every
reload. This revision fixes the second here; the other two are fixed in the stacked pull
requests.
Later review (2026-11-18): Claude Code (claude-fable-5-2) rebased this onto main and applied the fixes; claude-opus-5-5 and gpt-6.2-sol (Codex) each reviewed it independently. gpt-6.2-sol found that the cleanup deleted a startup schedule an administrator saved after the seed, and that an oversized interval overflowed its timer; both are fixed here.
Run plugin tasks on their manifest default schedule
Plugin tasks now select their default trigger from a runnable binding trigger first, then a validated manifest default, then startup. Implemented in task_registry.go and mirrored in the web display helper taskTrigger.ts
The task manager adds DefaultFollowingTask: plugin tasks run their defaults without seeding a saved schedule, and GetSchedule reports the defaults until an admin saves one (manager.go)
Revision-zero schedule ETags now hash the reported triggers instead of using only the revision, so stale writes are rejected when manifest defaults change (admin_tasks.go)
Migration clears startup-equal binding triggers and deletes qualifying seeded plugin schedules so manifest defaults take precedence (migration)
Risk: the migration deletes plugin task trigger and schedule rows (startup-only, revision ≤ 2, no matching interval/daily/weekly binding) and the down migration restores nothing; existing schedules saved in earlier releases may have nonzero revisions and still take precedence
Plugin tasks now use runnable binding triggers, manifest defaults, or a startup trigger when no schedule has been saved. Admin APIs expose manifest defaults and use revision-zero ETags that reflect schedule changes. The web interface displays the selected schedule and sends an empty trigger when none is set.
The registry validates and normalizes binding and manifest triggers, then selects a runnable trigger or falls back to startup. The migration clears qualifying persisted startup schedules.
Tasks that follow defaults use them until an administrator saves a schedule. Revision-zero schedule reads return current defaults. Tests cover changed defaults and saved-schedule precedence.
Capability responses expose manifest defaults. Revision-zero schedule ETags include a digest of the current triggers. The web interface uses the manifest default when no runnable binding trigger is available and sends an empty trigger when none is set.
The API and architecture documentation describes trigger precedence, schedule persistence, revision-zero validators, migration behavior, and binding-trigger semantics.
Plugin tasks now follow manifest default schedules until an administrator saves one. Remaining issues are narrow: a disabled task can briefly run on a starting server when another server saves a schedule at the same moment, the plugin page can display a schedule the server will not use for an oversized interval, and the migration notes omit which schedules survive. None should cause serious harm, but they are worth fixing before merge.
Security architecture risk: Moderate · up to 6a84a
The cleanup can discard a schedule saved during an upgrade if another server is still accepting changes. This can restore automatic plugin execution after an administrator disabled it. Normal schedule edits retain conflict protection, and the inspected changes do not grant plugins new execution capabilities.
Retained concerns
Medium · architecture · inferred: The cleanup can erase a concurrent administrator edit during an upgrade with another API server still serving. After a revision-two startup schedule enters the temporary candidate table, an administrator can save an empty schedule or add a runtime limit and commit a newer revision. The subsequent deletes use only the captured key, removing that newer policy. On restart, the task then follows its binding or manifest default instead. Migration locks serialize migrations and backups, but the inspected schedule writer takes neither lock. An all-stopped upgrade avoids the race; deployment-wide write exclusion is not established. The no-op Down operation cannot recover the removed policy.
Security review details
Security Blast Radius
inferred — The rollout concern affects qualifying plugin-task policies in the shared database, identified by installation and capability. Losing such a policy can affect every API server when it reloads that task. The inspected change does not establish cross-tenant access or additional host privileges.
Security Findings and Attack Paths
inferred — The supported concern is loss of administrator execution policy during concurrent migration, not an unauthenticated attack path. A disabled automatic schedule or newly imposed runtime limit can be removed by the cleanup, returning subsequent execution to plugin-authored defaults. Exploitation by an unprivileged caller was not established.
Trust Boundaries and Controls
observed — Installation, task-binding mutation, and schedule editing remain administrator-class operations. Binding precedence and disabled-binding exclusion remain enforced. Manifest triggers must pass type-specific validation, the SDK interval floor, and an overflow-safe interval ceiling before use.
Hardening Proposals
proposed — Preserve administrator authority during cleanup by excluding concurrent schedule writes deployment-wide, or by locking candidate schedule parents in the writer's order and revalidating eligibility before deletion. Retaining removed configuration would also permit targeted recovery without a database-wide restore.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title 'feat(plugins): run plugin tasks on their manifest default schedule' matches the main change: plugin tasks now run on the manifest's default_trigger when no saved or binding schedule exists.…
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.
Description check
The description is specific and related to the changeset. It states that plugin tasks now run on their manifest default_trigger, with a precedence order of saved schedule, binding trigger, manifest de…
Full details: Title check
Explanation
The title 'feat(plugins): run plugin tasks on their manifest default schedule' matches the main change: plugin tasks now run on the manifest's default_trigger when no saved or binding schedule exists. The changeset adds ManifestDefaultTrigger, DefaultFollowingTask, a migration, and API/UI support for default_schedule, all centered on this behavior. The title is concise and specific, and it does not describe anything absent from the changeset.
Full details: Description check
Explanation
The description is specific and related to the changeset. It states that plugin tasks now run on their manifest default_trigger, with a precedence order of saved schedule, binding trigger, manifest default, then one startup run. It explains the migration that clears startup-only binding triggers and never-edited startup schedules, and it describes the DefaultFollowingTask interface, the default_schedule API field, and the plugin page switch change. It also lists validation steps and risks, which match the files in the raw summary.
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
Minor changes:#1224 C1 now reaches a post-lifecycle sync: a catalog plugin with scheduled_task.v1 can register its task without a restart. Catalog resolution, checksum verification, and package-rejection paths are unchanged. For #1225 C1, the installed-plugin detail page changes the scheduled-task copy and displayed default schedule; toggling an unbound task now sends {} instead of forcing startup. Both C2 cases’ catalog settings and tier checks are unaffected. The Check Plugin Updates feedback path is unchanged. Please re-check both C1 cases after merge.
Suggested fix: Keep Validation tasks: changes #1224 C1; changes #1225 C1 and re-check both cases after merge.
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.
The reason will be displayed to describe this comment to others. Learn more.
Preserve the frozen v1 task-binding contract
For clients using the v1 task-binding endpoint, this replaces the restart-required response with live application: disabling a binding can now cancel a running task immediately, and restart_required changes from true to false. This is new feature behavior, not a critical fix needed to keep the bridge usable. Keep the v1 handler's existing contract and expose live binding application through the v2 operation, as required by the repository's v1 freeze.
The reason will be displayed to describe this comment to others. Learn more.
Keeping this as is. The v1 response schema doesn't change: restart_required is still there and still answers whether a restart is needed. The answer is now false because the server applies bindings without one. v1 and v2 write the same binding store, and each server's sync applies every binding no matter which route wrote it, so a v1 write can't be made to wait for a restart without stopping reconciliation for everyone. Returning true would tell v1 clients something that isn't so. The PR description notes this under Approach. Leaving the thread open in case a maintainer reads the v1 freeze differently.
The reason will be displayed to describe this comment to others. Learn more.
Not changing this. The v1 and v2 PUTs write the same plugin_task_bindings row, and every API server now reconciles its plugin tasks from that table at least once a minute (TaskRegistry.RunSyncs). A v1 write therefore applies without a restart whatever the v1 handler answers, including a disable that unregisters the task. Answering restart_required: true would ask for a restart the binding doesn't need. The response shape is unchanged, only the value is now accurate, and docs/admin-api.md records that v1 shares this path.
The Validation tasks: line overstates the impact on the existing cases.
#1224 C1 checks catalog installation/update, checksum verification, and graceful failures. The parent specifies metadata/marker and request/source-adapter fixtures; the added lifecycle hook only syncs scheduled_task.v1 capabilities and is best-effort.
#1225 C1 checks install/status/update feedback. The changed schedule display and switch are specific to scheduled-task capabilities and write through a separate task-binding route.
Both C2 cases cover catalog settings and tier/update-policy behavior, which this PR does not change.
Please use: Validation tasks: none
If the new plugin-scheduling behavior needs a v1 validation record, add a dedicated task; these existing C1 cases do not cover it.
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.
Partly agreed. I've dropped #1225 C1: the schedule copy and switch appear only for plugins with scheduled tasks, and the plugins that case validated have none, so the page the validator saw doesn't change. I'm keeping #1224 C1: every install and update now runs a task sync, which is best effort and doesn't fail the install, but it sits on the install and update path that case covers, so a quick re-check is worth it. The line now reads Validation tasks: changes #1224 C1.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
The reason will be displayed to describe this comment to others. Learn more.
Version changes to an unsaved task's effective schedule
For a plugin task without a saved schedule, changing its binding or manifest default and restarting the server changes the triggers returned here but leaves the revision at zero. taskScheduleTag in internal/apiv2/admin_tasks.go uses only the task key and revision, so the changed representation receives the same strong ETag. An administrator who opened the editor before that change can therefore submit the old schedule afterward without receiving the expected 412, silently overriding the new default. Include effective-default changes in the guarded version and validate that version when accepting the first saved schedule.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 52f0839. At revision zero the schedule ETag now also carries a digest of the default triggers, so once the binding trigger or manifest default changes, GET and the PUT precondition produce a different tag and a stale If-Match gets 412. A saved schedule is still fenced by its revision alone. The handler compares the defaults it reads just before the write; I didn't move that check into the repository transaction, since the defaults live in the task manager rather than the database.
The reason will be displayed to describe this comment to others. Learn more.
Default schedule changes do not invalidate the schedule ETag
A changed default can retain the same strong ETag, allowing a stale If-Match to overwrite it without a conflict. Include the effective default in the validator and check it during the guarded update.
Prompt for LLM
File internal/taskmanager/manager.go, lines 445-446:
Default schedule changes do not invalidate the schedule ETag
An unsaved plugin schedule can change after a binding or manifest update while retaining revision zero, so the v2 endpoint returns the same strong ETag for different triggers and accepts a stale editor's `If-Match`, overwriting the new default without a conflict. Include the effective default in the validator and check it during the guarded update.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 52f0839: an unsaved schedule's ETag now includes its default triggers, so a changed default changes the tag and the guarded PUT answers 412 to the old one.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Based on your description, commit 52f0839cd addresses the stale ETag concern: changing an unsaved schedule’s default changes its ETag, and a guarded PUT with the old ETag returns 412 Precondition Failed.
Tasks with explicit startup bindings switch to a manifest interval or daily schedule after migration. Preserve explicit startup bindings in plugin_task_bindings rather than treating every matching trigger as a UI-generated default.
Prompt for LLM
File migrations/sql/20261106015045_plugin_tasks_follow_manifest_default.sql, lines 9-11:
Migration erases explicit startup binding triggers
This update also clears startup triggers explicitly set through the task binding API, so those tasks switch to a manifest interval or daily schedule after the migration instead of running at startup. Preserve explicit startup bindings rather than treating every matching value as a UI-generated default.
The reason will be displayed to describe this comment to others. Learn more.
Leaving this as is; the maintainer approved it. The admin plugin page's switch wrote {"type":"startup"} into every binding it saved without a trigger, so a stored startup trigger can't be told apart from one an administrator chose. Clearing it keeps the task on startup unless the plugin declares a default_trigger. The migration has already run on a deployed database, so it won't be edited. 37bc3d0 documents the effect in plugin-scheduled-tasks.md.
The reason will be displayed to describe this comment to others. Learn more.
Understood. Given the indistinguishable stored triggers, maintainer approval, and the migration’s deployment, I withdraw the suggestion to change it. The documented behavior is an accepted tradeoff: an explicit startup binding may instead follow the manifest default after migration.
Revises an earlier Kody suggestion on internal/plugins/task_registry.go:354 (2026-11-05 16:15 UTC).
Administrator-saved startup schedules silently change to binding or manifest schedules after upgrade. Preserve those schedules in task_schedules or use a migration strategy that does not discard indistinguishable edits.
Prompt for LLM
File migrations/sql/20261106015045_plugin_tasks_follow_manifest_default.sql, lines 36-37:
**Revises an earlier Kody suggestion** on `internal/plugins/task_registry.go:354` (2026-11-05 16:15 UTC).
Migration deletes administrator-saved startup schedules
Deleting every matching startup schedule also deletes schedules explicitly saved by administrators, so an existing task-page choice silently changes to the binding or manifest schedule after upgrade. Preserve administrator-authored schedules or introduce a migration strategy that does not discard indistinguishable edits.
The reason will be displayed to describe this comment to others. Learn more.
Leaving this as is; the maintainer approved it. The task manager seeded every plugin task's schedule as one startup trigger, so a seeded row can't be told apart from an administrator who saved exactly "at startup". After the cleanup such a task still runs at startup unless the plugin declares a default_trigger. The migration has already run on a deployed database, so it won't be edited. 37bc3d0 documents the effect in plugin-scheduled-tasks.md.
The reason will be displayed to describe this comment to others. Learn more.
Understood. I’ll withdraw the suggestion: the migration’s ambiguity and its effect are known, the maintainer approved the trade-off, and the migration has already run on a deployed database. The effect is documented in plugin-scheduled-tasks.md.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Quick104
changed the title
feat(plugins): schedule plugin tasks from their manifest default and apply bindings live
feat(plugins): run plugin tasks on their manifest default schedule
Nov 6, 2026
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: cc20d715-3773-4121-929c-defd91fad14b
Commits
Reviewing files that changed from the base of the PR and between f1f3020 and 37bc3d0.
Files ignored due to path filters: 1
go.sum is excluded by !**/*.sum
Files selected for processing: 9
contracts/api/v2/openapi.json
docs/admin-tasks-api.md
docs/architecture/plugin-scheduled-tasks.md
go.mod
internal/apiv2/admin_plugin_configuration.go
internal/apiv2/admin_plugin_installations.go
internal/apiv2/admin_tasks.go
internal/apiv2/admin_tasks_test.go
web/src/api/v2/schema.ts
Files skipped from review as they are similar to previous changes: 3
internal/apiv2/admin_plugin_installations.go
internal/apiv2/admin_plugin_configuration.go
web/src/api/v2/schema.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 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>
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Recheck saved state before installing default triggers. · manager.go:86
internal/taskmanager/manager.go:86 Minor · Functional Correctness · Quick win
Recheck saved state before installing default triggers.
Start installs DefaultTriggers() for a default-following task when GetTriggers returns nil, without rechecking saved state. The GetOrCreateTriggers path is the one that rechecks, as the comment at internal/taskmanager/manager.go:88-90 states for initialization. If another API server saves an empty schedule after GetTriggers returns nil, this server still runs the defaults. The administrator's disabled task then runs on this server until it restarts. A restart reads the saved empty schedule and does not run the task.
The window is short because it covers only the two repository calls during startup. The race still exists and should be closed. Before using the defaults, read the saved state again. If a schedule now exists, use it. If none exists, use the defaults without writing a schedule row, so defaults remain unpersisted. A recheck narrows the window. Closing it fully requires the saved-state read and the default install to be atomic.
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: cdf75102-6d55-4259-8940-258060aeaa10
Commits
Reviewing files that changed from the base of the PR and between 37bc3d0 and 6a84a6d.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
On the out-of-diff note about TaskManager.Start (manager.go:86): not changing this here. The window is the two repository reads at startup, a recheck only narrows it, and the outcome matches what this PR already documents: a schedule saved on another server reaches this one at its next start. Closing it needs the saved-state read and the default install to be atomic, which belongs with the live-apply work in #3611.
The reason will be displayed to describe this comment to others. Learn more.
Preserve revision-two edits on legacy schedules
For schedules carried through 20260906000622_task_schedule_revisions.sql, the migration initializes the revision to 1, so the first subsequent administrator save advances it to 2—not 3. If that save selects a single startup trigger and the binding has no interval/daily/weekly trigger, this cleanup deletes the explicitly edited schedule and silently switches the task to its manifest default. This affects edits made after schedule revisions were introduced, beyond the acknowledged ambiguity for earlier edits. Preserve these legacy revision-two edits rather than treating every revision-two schedule as an untouched seed.
The reason will be displayed to describe this comment to others. Learn more.
Correct, and not fixable from the data: a schedule that predates revisions sits at revision 1, so its first save lands on 2, the same revision a fresh seed has, and nothing else stored separates the two. Keeping every revision-2 schedule would keep every seed, which is the row this cleanup exists to remove. The case is a plugin task schedule from before September, saved once since, to exactly one startup trigger with no runtime limit; that task then follows its binding and manifest default. 54622d9 names this case in the migration comment and the architecture doc.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
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
api-v2API v2 / Huma migration program (epic #135); long-running, stacked by phasedependenciesPull requests that update a dependency fileenhancementNew feature or requestgoPull requests that update go codeimpact: usabilityCore flow broken or severely blockedjavascriptPull requests that update javascript codepriority: P2Limited scope, workaround exists, or polishsize/XL500–999 added + deleted lines (all files); change volume, not priority.
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: N/A
Validation tasks: none (this no longer touches plugin install or update, so #1224 C1 is unaffected; the live task sync that did is now in feat/plugin-task-live-apply)
A plugin's scheduled task with no binding runs once at each server start, whatever schedule its
plugin needs. SDK
scheduled_task.default_triggerlets a manifest declare one, but the serverignores it. Two kinds of stored row would also hide it on existing servers: the admin plugin
page's on/off switch stored
{"type":"startup"}as the binding trigger, and the task managersaved every plugin task's first default (startup) as its schedule.
This change runs plugin tasks on their manifest default and clears those rows. Live apply of
binding and plugin changes, and running each firing on one API server, are split into stacked
pull requests on top of this one.
Approach
manifest's
default_trigger, one run at startup. A trigger the task manager can't run fallsthrough to the next source. Binding and manifest triggers keep only the fields their type reads.
taskmanager.DefaultFollowingTask).A saved schedule therefore always means an administrator's edit, and a new manifest default or
binding trigger reaches every other task at the next server start. The task schedule
GETanswers the default at revision zero; the first
PUTsaves a schedule.plugin_tasks_follow_manifest_defaultresets binding triggers equal to{"type":"startup"}to{}and deletes plugin task schedules that are exactly one startuptrigger and were never edited (revision 2 or lower, which is where a seed leaves one), unless
the binding sets an interval, daily or weekly trigger (then the startup schedule was an edit).
An interval longer than a timer can hold is not runnable and falls through like any other
trigger the task manager can't run. The plugin page's switch now resends only a trigger set through the API.
default_schedule, and the plugin page shows it for atask with no binding trigger. Binding writes still answer
restart_required: true.An earlier revision of this pull request saved schedules on binding writes and moved saved
schedules that still equaled the old default on plugin updates. The rule above replaces both.
Validation
mainthe migration deleted only never-edited startup schedules and left an edited one, an interval schedule and a core task alone.internal/plugins,internal/taskmanager/...,internal/apiv2plugin and task routes,internal/api/handlersplugin and task routes): pass.make lint-changed, the OpenAPI, contract, web types, route inventory, migration ledger and local-path checks: pass.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3551/
Surface and build: web admin plugin page, desktop and phone widths, this branch.
Risks
revisions existed (September) can't be told apart from a seeded schedule, so the migration
clears it. That task then follows its binding and manifest default; until its plugin declares
a default, that is still one startup run. A startup schedule saved since then is kept.
deleting the saved schedule row.
that.
Checklist
AI Disclosure
restart durability and run cancellation. A later four-agent Claude review found that every API
server ran each firing, that switch-written
{"type":"startup"}binding triggers outranked themanifest default, and that a daily trigger carrying
day_of_weeklooked changed on everyreload. This revision fixes the second here; the other two are fixed in the stacked pull
requests.
mainand applied the fixes; claude-opus-5-5 and gpt-6.2-sol (Codex) each reviewed it independently. gpt-6.2-sol found that the cleanup deleted a startup schedule an administrator saved after the seed, and that an oversized interval overflowed its timer; both are fixed here.🤖 Generated with Claude Code
Note
Run plugin tasks on their manifest default schedule
DefaultFollowingTask: plugin tasks run their defaults without seeding a saved schedule, andGetSchedulereports the defaults until an admin saves one (manager.go)Macroscope summarized 54622d9.