Skip to content

feat(server): server-side scheduled tasks — start agent runs automatically - #7986

Open
ImBIOS wants to merge 2 commits into
pingdotgg:mainfrom
ImBIOS:feat/scheduled-tasks-upstream
Open

feat(server): server-side scheduled tasks — start agent runs automatically#7986
ImBIOS wants to merge 2 commits into
pingdotgg:mainfrom
ImBIOS:feat/scheduled-tasks-upstream

feat(server): gate scheduled tasks behind a settings switch

d9b0640
Select commit
Loading
Failed to load commit list.
MacroscopeApp / Macroscope - Effect Service Conventions failed Aug 25, 2026 in 56s

Effect Service Conventions: 4 findings (previously posted)

The four convention violations flagged on the earlier revision of this PR are still present at d9b0640; no new inline comments were posted to avoid duplicates.

  • apps/server/src/orchestration/Services/TaskScheduler.ts / apps/server/src/orchestration/Layers/TaskScheduler.ts — new service is split across Services/ + Layers/ and keeps a standalone TaskSchedulerShape. Collapse into apps/server/src/orchestration/TaskScheduler.ts with the interface inline in the Context.Service declaration, an exported make, and export const layer = ...; reference the shape as TaskScheduler["Service"].
  • apps/server/src/orchestration/Services/TaskFireReactor.ts / apps/server/src/orchestration/Layers/TaskFireReactor.ts — same split plus standalone TaskFireReactorShape and a ...Live layer name.
  • apps/server/src/persistence/Services/ProjectionTasks.ts / apps/server/src/persistence/Layers/ProjectionTasks.ts — standalone ProjectionTaskRepositoryShape and Services/+Layers/ split; follow the already-migrated apps/server/src/persistence/AuthSessions.ts single-module form.
  • apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts (~L113, L2422) — parseScheduleJson manufactures an Error purely to populate cause, and PersistenceDecodeError.issue/message are then derived from that string rather than from the real schema issue. Decode with Schema.decodeUnknownEffect and map the actual SchemaError, keeping the underlying error as cause and adding structural context (task id).

Details

Note

Your check run agent prompt is: .macroscope/check-run-agents/effect-service-conventions.md
More information about how Check Run Agents work can be found in our Help Center.

Verified against head d9b06406f41b55bd4b320996dd60d19313e0a5a9:

  • Services/TaskScheduler.ts still declares TaskSchedulerShape (lines 5-17) with the tag at line 19.
  • Services/TaskFireReactor.ts still declares TaskFireReactorShape; construction remains in Layers/TaskFireReactor.ts as TaskFireReactorLive.
  • Services/ProjectionTasks.ts still declares ProjectionTaskRepositoryShape; Layers/ProjectionTasks.ts exports ProjectionTaskRepositoryLive.
  • Layers/ProjectionSnapshotQuery.ts still contains parseScheduleJson (L113) and the Effect.tryPersistenceDecodeError({ issue: cause.message }) mapping (L2422-2428).

Since no code changed in response to the earlier comments, no duplicate inline comments were posted.

Out-of-scope observation (not commented, file type not in this check's include patterns): packages/client-runtime/package.json adds an export subpath ./state/taskCommands pointing at ./src/state/taskCommands.ts, but that file does not exist in the tree — the new task command factory lives in src/state/orchestration.ts. Worth confirming before merge.


🔍 Agent activity — 4 tool calls

💭 Comparing the diff between the flagged commit and current head, the same structural elements are still present, so the previously identified issues remain unresolved. I need to avoid posting duplicate comments for unaddressed issues that were already flagged.

1. git_tools6f33ca5..d9b0640

💭 It seems the previous commit was force-pushed away, so the flagged issues likely still remain per the diff. I should check the current state of the files to confirm and look for any new issues.

2. browse_code — apps/server/src/orchestration/Services/TaskScheduler.ts

💭 Since the diff seems unchanged from before, I shouldn't repost duplicate issues, but I want to double-check for anything new I might've missed, so I'm spot-checking other modules like the orchestration directory for convention issues beyond the already-flagged PersistenceDecodeError usage. Overall, since the flagged issues persist in the changed scope and code appears unchanged, the check should still fail—I'll do a couple more quick verifications before concluding, but there's no reason to repost findings that are already on record.

3. browse_code — packages/client-runtime/src/state/*.ts

💭 I notice package.json references a taskCommands.ts file that doesn't actually exist — a broken export mapping. But since package.json isn't in my include patterns and this isn't really an Effect service convention issue, it's likely out of scope for what I'm checking, so I should probably skip it. Since findings are already posted and the code is unchanged, I won't repost — I'll go with a failure verdict referencing the existing comments. Let me just double-check whether the head commit addressed decodeTaskRows in ProjectionSnapshotQuery before finalizing.

4. git_tools — parseScheduleJson|PersistenceDecodeError|Shape\b

💭 Nothing has changed since the last check — all four previously flagged findings are still present and unresolved, so I shouldn't repost them. I'll mark this as a failure, summarizing that those 4 findings remain unaddressed.


Agent Credits: 77 credits