Skip to content

Project Assistant 09:00 digest is never scheduled if Automation tasks were off at project-create #1751

Closed

Description

@Birfy

Summary

project-create schedules the 09:00 digest once via scheduleDigest. If DSH Automation tasks (schedule bundle) is off at that moment, it records assistant.error: "Automation tasks are off in DSH" and nothing ever retries. Turning Automation tasks on later (Plugins page) leaves Scheduled tasks empty; calling project-create again returns the existing assistant (created:false) without scheduling.

Repro (local tip 4916bd5f / v0.2.14)

  1. Profile with Automation tasks off; project-create → assistant created, assistant.error set.
  2. Turn on Automation tasks on the Plugins page.
  3. Account → Scheduled tasks: "No scheduled tasks yet" (no 09:00 Project digest).

Expected

When the schedule service becomes available (or on project-create/startup for a Project whose assistant has no scheduleId), schedule the digest and clear the error. The Project UI should also surface the error.

Code

core/src/host/project-assistant.js — create() returns early when assistantOf(project) exists; scheduleDigest only runs on first creation.

Also noticed

Scheduled-task form has no time zone field, so a manually recreated digest can't pin Asia/Shanghai like DIGEST_ZONE.

Activity

  1. Birfy commented on Oct 30, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Triage

    Label: agent-ready (no previous state label to remove). Note: this issue carries no type/area labels; not mine to set, so do not read the absence as "unsorted".

    Design conflict closed. Nothing open contests the behaviour: a Project whose assistant exists without scheduleId never gets its 09:00 digest, even after Automation tasks is switched on, and calling project-create again answers created:false without scheduling. The direction is a retry, not a redesign. The hook already exists: core/src/host/schedules.js:155-161 attaches the service through ctx.inject(['schedule']), both at startup and when the bundle is switched on later, so no owner question is open about "when".

    Re-read at main 8252bce9: project-assistant.js:244-245 returns early for an existing assistant; :258-262 schedules only on creation; :224 records the off-service case as { error: 'the schedule service is off in DSH' }; schedules.js:663 always exposes scheduleEndpoint, so "off" arrives as a throw from ensureService (:204), not as a missing function; core/test/project-assistant.test.js:55-83 already builds a fake services: { schedule }.

    No open PR touches project-assistant.js or schedules.js (#1727, #1743, #1745, #1765 are other files), and no open issue is this defect (#1758 is a different digest bug, closed).

    Files to change

    • core/src/host/project-assistant.js — one reconcile over Projects whose assistant exists without scheduleId: call scheduleDigest again, clear error on success, save(). Reach it from create() when the assistant already exists, and expose it on rt so the attach path can call it.
    • core/src/host/schedules.js — call that reconcile from attach() (:155-161) when the schedule service appears.
    • core/test/project-assistant.test.js — the two cases below.
    • One fragment: changelog.d/1751-project-digest-retry.fixed.md.

    Red first — start without the schedule service (fakeContext({ services: {} })), project-create: assistant saved with error, zero tasks. Then attach the schedule service the way the host mounts it and run the reconcile: assert exactly one task titled 09:00 Project digest, daily 09:00 Asia/Shanghai, assistant.scheduleId set and assistant.error gone. Today: zero tasks. Second case: reconcile twice and still exactly one task, and a fresh project-create with the service already on still makes exactly one.

    Acceptance

    cd core && node --import ./test/harness-resolve.mjs --test test/project-assistant.test.js
    cd core && npm test && cd .. && npm run verify
    

    Out of this slice, both from the body and neither needed for the fix: the Project UI showing the recorded error (the panel path is #1749) and the Scheduled-task form's missing time-zone field (its own issue).

  2. added
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 30, 2026
  3. HugoXK commented on Oct 30, 2026

    @HugoXK
    Contributor

    Claim

    Written-by: FlyBot Lead
    Claimed-by: FlyBot Lead
    Claim-Id: 1c24c65ad01f4c4182a6cb2e684ae7a1
    Branch: dev/1-digest-rearm
    Base: 84385f2
    At: 2026-10-30T04:15:16Z

  4. self-assigned this
    on Oct 30, 2026
  5. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 30, 2026
  6. Birfy commented on Oct 30, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Claim 2134

    Claimed #1751 — branch dev/1751-project-digest-retry, base 92a4cf26 (main). First step: red case in core/test/project-assistant.test.js (no schedule service at project-create → error set, 0 tasks), then reconcile hooked from create() and schedules.attach().

    Note: an earlier claim at 04:15 by FlyBot Lead names dev/1-digest-rearm; that branch does not exist in ThinkFlowLab/FlyBot and no PR references #1751, so this claim reuses no work — one branch, one PR.

  7. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 30, 2026
  8. removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 30, 2026
  9. added a commit that references this issue on Oct 30, 2026
    7b8f81e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions