Refactor heartbeat commands onto control plane#162
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aafa7158d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) { | ||
| const id = stringFlag(parsed.flags, 'id') ?? parsed.subcommand ?? DEFAULT_HEARTBEAT_TASK_ID; | ||
| const intervalMs = parseDurationMs(stringFlag(parsed.flags, 'every') ?? stringFlag(parsed.flags, 'interval') ?? '30m'); | ||
| const pollIntervalMs = parseDurationMs(stringFlag(parsed.flags, 'poll') ?? '60s'); |
There was a problem hiding this comment.
Do not report an unapplied poll interval
For heddle heartbeat start --poll <duration>, this parses and later prints the requested poll interval, but the embedded control-plane server and scheduler were already started before this function is called and no pollIntervalMs is passed through ControlPlaneCommandRuntimeService.resolve/startHeddleControlPlaneServer. In embedded mode the scheduler still uses the server default poll interval, so the command can claim poll=5s while actually polling at the default cadence.
Useful? React with 👍 / 👎.
aafa715 to
10d78d2
Compare
10d78d2 to
2a48ad6
Compare
Summary
src/cli-v2/commands, leavingsrc/cli/heartbeat.tsas a legacy compatibility export only.heartbeatRunDueTaskscontrol-plane mutation soheddle heartbeat runcan ask the server to execute due work.Expected Behavior
heddle heartbeat task ...andheddle heartbeat runs ...now attach to the live control-plane server when one exists; otherwise they start an embedded control-plane server for the command.heddle heartbeat runasks the server to run due heartbeat tasks, or one explicit task with--task.heddle heartbeat startcreates or updates a heartbeat task through the API and reports the server-backed scheduler. If it started an embedded server and is not running--once, it keeps that server alive until Ctrl+C.Verification
yarn typecheckyarn lintyarn test:unit src/__tests__/unit/tui/heartbeat-cli.test.ts src/__tests__/unit/cli-v2/chat-v2-runtime.test.ts src/__tests__/unit/core/import-boundaries.test.tsyarn test:integration src/__tests__/integration/control-plane/control-plane-heartbeat-mutations.test.tsgit diff --checkyarn -s cli:dev heartbeat task listyarn -s cli:dev heartbeat runs list --limit 1Manual Test Notes
yarn -s cli:dev heartbeat task list; expected output starts with an attach notice and lists tasks from the control-plane API.yarn -s cli:dev heartbeat runs list --limit 1; expected output starts with an attach notice and prints the latest run view.yarn -s cli:dev heartbeat task list; expected output starts with an embedded server notice, then returns the API-backed task list.yarn -s cli:dev heartbeat run; expected output ischecked=... ran=... failed=...from the server-backed due-task mutation.yarn -s cli:dev heartbeat run --task <taskId>; expected output isaccepted=true task=<taskId> status=<status>.