feat(server): server-side scheduled tasks — start agent runs automatically - #7986
feat(server): server-side scheduled tasks — start agent runs automatically#7986ImBIOS wants to merge 2 commits into
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 acrossServices/+Layers/and keeps a standaloneTaskSchedulerShape. Collapse intoapps/server/src/orchestration/TaskScheduler.tswith the interface inline in theContext.Servicedeclaration, an exportedmake, andexport const layer = ...; reference the shape asTaskScheduler["Service"].apps/server/src/orchestration/Services/TaskFireReactor.ts/apps/server/src/orchestration/Layers/TaskFireReactor.ts— same split plus standaloneTaskFireReactorShapeand a...Livelayer name.apps/server/src/persistence/Services/ProjectionTasks.ts/apps/server/src/persistence/Layers/ProjectionTasks.ts— standaloneProjectionTaskRepositoryShapeandServices/+Layers/split; follow the already-migratedapps/server/src/persistence/AuthSessions.tssingle-module form.apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts(~L113, L2422) —parseScheduleJsonmanufactures anErrorpurely to populatecause, andPersistenceDecodeError.issue/messageare then derived from that string rather than from the real schema issue. Decode withSchema.decodeUnknownEffectand map the actualSchemaError, keeping the underlying error ascauseand 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.tsstill declaresTaskSchedulerShape(lines 5-17) with the tag at line 19.Services/TaskFireReactor.tsstill declaresTaskFireReactorShape; construction remains inLayers/TaskFireReactor.tsasTaskFireReactorLive.Services/ProjectionTasks.tsstill declaresProjectionTaskRepositoryShape;Layers/ProjectionTasks.tsexportsProjectionTaskRepositoryLive.Layers/ProjectionSnapshotQuery.tsstill containsparseScheduleJson(L113) and theEffect.try→PersistenceDecodeError({ 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_tools — 6f33ca5..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