Skip to content

feat(schedule): send messages later on existing threads - #1253

Open
luoye520ww wants to merge 9 commits into
KunAgent:developfrom
luoye520ww:codex/scheduled-send
Open

feat(schedule): send messages later on existing threads#1253
luoye520ww wants to merge 9 commits into
KunAgent:developfrom
luoye520ww:codex/scheduled-send

Conversation

@luoye520ww

Copy link
Copy Markdown
Collaborator

Summary\nAdds one-time scheduled sends to existing threads with frozen prompt/model/provider/account/attachments snapshots, FIFO ordering, retry and restart-safe queueing.\n\n## Tests\n- npm.cmd run typecheck\n- npm.cmd exec vitest run src/main/schedule-runtime.scheduled-send.test.ts src/main/ipc/scheduled-send-ipc.test.ts src/renderer/src/components/chat/FloatingComposer.scheduled-send.test.ts\n- npm.cmd --prefix kun test -- src/server/routes/scheduled-send-admission.test.ts\n- npm.cmd run build\n- git diff --check\n\nFixes #1215

@luoye520ww
luoye520ww force-pushed the codex/scheduled-send branch from ba51675 to 0c13f64 Compare August 30, 2026 16:37
@luoye520ww
luoye520ww force-pushed the codex/scheduled-send branch from 0c13f64 to 23aca3d Compare August 30, 2026 17:01
@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Local validation for head 23aca3de941352713d916a346158a5e067e3a264:

  • npm.cmd exec vitest run src/main/schedule-runtime.scheduled-send.test.ts src/main/ipc/scheduled-send-ipc.test.ts src/renderer/src/components/chat/FloatingComposer.scheduled-send.test.ts -> 25 passed
  • npm.cmd --prefix kun test -- src/server/routes/scheduled-send-admission.test.ts -> 3 passed (2 runtime manifest + 1 admission)
  • npm.cmd run typecheck -> passed
  • npm.cmd run build -> passed
  • git diff --check -> passed

The required Quality gates job fails in unrelated existing repository tests (agent-loop, hooks, graph, provider, TUI, etc.) and the file-line guard reports only pre-existing files (kun/src/manager/service-manager-router.ts, kun/src/manager/service-manager.test.ts, src/main/kun-process.ts). The scheduled-send tests pass in the same CI run.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Post-CI update (head 17f55c8): added server-side immutability for existing-thread scheduled-send snapshots (prompt, workspace, thread, provider, model, reasoning, account/attachments via scheduledSend) plus regression coverage; title/enabled/time edits remain allowed. Local targeted test: npm.cmd exec vitest run src/main/schedule-runtime.scheduled-send.test.ts (17 passed). npm.cmd exec eslint src/main/schedule-runtime.ts src/main/schedule-runtime.scheduled-send.test.ts and git diff --check pass. Full npm.cmd run typecheck reaches existing baseline dependency/type failures in design-svg, MCP client, Cursor SDK, TUI, etc.; no failures originate in scheduled-send files. Existing CI run 33324088421 had 19 unrelated unit-test files failing (65 tests), so PR remains blocked on repository baseline failures.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

CI fix pushed at head 03012c2: Quality gates failure was only check:file-lines (scheduled-send test 708 > 700). Compressed the new regression test to 690 lines total. Revalidated: npm.cmd exec vitest run src/main/schedule-runtime.scheduled-send.test.ts -> 17 passed; targeted ESLint and git diff --check pass. Awaiting a fresh GitHub run.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Review fixes pushed at head 16a188f: existing-thread sends now reject recurring schedules; paused sends are rechecked immediately before admission; one-time retry exhaustion is persisted as disabled terminal error; and post-admission execution errors for one-time sends no longer reschedule. Added regression coverage; test file remains at 700-line gate. Targeted scheduled-send suite: 19 tests passed locally before final compression; rerunning now.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Additional review fixes at head efdfaa1: runtime now rejects existing-thread sends with recurring schedules or missing atTime; frozen send execution fields (mode, orchestration, worktree, dependencies, channel) cannot be mutated; one-time terminal errors disable/clear nextRunAt; admission rechecks enabled state. Local scheduled-send suite: 18 passed; targeted ESLint and git diff --check pass. Full typecheck remains blocked by unrelated baseline dependency/type errors documented earlier.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Latest review fix at head 2b0d8f9: rechecks persisted task cancellation/enabled state immediately before POST after model/worktree awaits, preventing late admission. Settlement now honors disable state. Targeted scheduled-send suite passes (18 tests); ESLint and diff check pass. CI reruns on this head.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

CI gate fix at head 4a8ab97: compressed the retry exhaustion condition to bring schedule-runtime-queue.ts under the 700-line repository limit (now 699 lines). Revalidated targeted scheduled-send tests (18 passed), ESLint, and git diff --check.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Post-CI review for final head 4a8ab97: run 33328442086 passed checkout/install, Typecheck and Lint (including file-line gate). Unit tests then failed with the same existing baseline set: 19 files / 65 tests (agent-loop, graph, TUI, secret-store, extension tool/provider and other unrelated suites); 5,039 tests passed. No scheduled-send test failed. Platform package jobs were skipped only because Quality gates aggregates the unrelated unit failures. PR remains open for maintainer review; no duplicate PR will be created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant