Repository navigation
fix(cron): reserve migrated heartbeat-task namespace - #123729
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 12:23 PM ET / 16:23 UTC. ClawSweeper reviewWhat this changesThe PR reserves the doctor-migrated Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open. This is a focused owner-boundary repair for a source-reproducible silent cron-delivery failure; I found no blocking patch defect. It is maintainer-authored/labeled, so it should remain for normal maintainer merge judgment after exact-head checks finish. Priority: P1 Review scores
Verification
How this fits togetherGateway and CLI cron requests create persisted jobs through the cron service; execution later selects normal main-session delivery or the heartbeat-task wake path. The change protects creation so a public declaration cannot enter the migration-only execution path. flowchart LR
A[CLI or Gateway declaration] --> B[Cron creation service]
B --> C{Reserved heartbeat-task key?}
C -->|Public caller| D[Explicit system-owned error]
C -->|Doctor-owned caller| E[Persisted cron job]
C -->|Ordinary key| E
E --> F[Runtime classification]
F --> G[Heartbeat wake or normal event delivery]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +17. Total +25 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single cron-service namespace guard after exact-head checks are green, preserving the existing runtime classification and direct update/remove path for persisted rows. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible with a public main-session Is this the best way to solve the issue? Yes. The service creation boundary is the narrowest canonical fix because both CLI and Gateway converge there; schema-, CLI-, or runtime-only guards would duplicate or miss the ownership policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2b31cf114ba4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
ClawSweeper review disposition before merge:
The exact-head ClawSweeper review reports no findings and names this service-boundary repair as the best possible solution. Its sole |
|
Merged via squash.
|
Closes #123728
What Problem This Solves
Fixes an issue where users creating a main-session system-event automation could use a declaration key beginning with
heartbeat-task:and have it silently treated as a doctor-migrated heartbeat task. Cron reported success while bypassing normal event delivery; with heartbeat disabled, the automation produced no operator-visible result.Why This Change Was Made
Cron creation now reserves the migrated heartbeat-task declaration namespace behind the existing
systemOwnedservice authority. One canonical predicate owns prefix classification and is shared by creation validation and runtime job detection. Existing doctor-migrated rows remain executable, editable, and removable.This deliberately avoids duplicating namespace policy in the CLI, Gateway schema, public config, protocol, or storage layer. The net-neutral attempt reused the existing ownership option and consolidated prefix detection; the remaining production growth establishes the missing owner boundary.
Production LOC: +14/-6 (net +8) | Tests: +28/-11 (net +17)
User Impact
Ordinary automation declarations using the reserved
heartbeat-task:namespace now fail with an explicit system-owned error before persistence. Normal declaration keys continue to create and run as before, and migrated heartbeat tasks remain fully manageable.Evidence
node scripts/run-vitest.mjs src/cron/service.heartbeat-payload.test.ts src/commands/doctor-heartbeat-task-migration.test.tsnode scripts/check-changed.mjs -- src/commands/doctor-heartbeat-task-migration.test.ts src/cron/heartbeat-task.ts src/cron/service.heartbeat-payload.test.ts src/cron/service/ops-mutations.ts src/cron/service/state.ts