Repository navigation
Conversation
be89f6c to
517fc08
Compare
Greptile SummaryAdds an optional Confidence Score: 5/5Safe to merge; remaining findings are P2 style and convention issues only. No P0 or P1 issues found. The two remaining findings — missing *.runtime.ts lazy-load boundary and no preHook clearing sentinel in the update tool schema — are P2 quality-of-life concerns that do not affect correctness or runtime behavior. Prior review concerns (#1–9 per the PR description) are resolved in this iteration. src/cron/service/timer.ts and src/infra/heartbeat-runner.ts for the dynamic import boundary; src/agents/tools/cron-tool.ts for the missing preHook clearing path in the update action. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/cron/service/timer.ts
Line: 1155-1156
Comment:
**Missing `*.runtime.ts` lazy-load boundary**
`pre-hook.js` is dynamically imported inline here and again in `src/infra/heartbeat-runner.ts:620`, but the repo convention (CLAUDE.md dynamic-import guardrail) requires a dedicated `*.runtime.ts` re-export boundary for lazy-loaded modules executing real work. Every other lazy-load in `src/cron/isolated-agent/` and `src/infra/` follows this pattern (e.g. `run.runtime.ts`, `heartbeat-runner.runtime.ts`). Without the boundary, tests cannot mock the seam to avoid actually spawning shell processes.
```suggestion
const { runPreHook } = await import("../pre-hook.runtime.js");
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/agents/tools/cron-tool.ts
Line: 252-265
Comment:
**No mechanism to clear `preHook` via the update tool**
The protocol schema (`CronJobPatchSchema` in `cron.ts`) accepts `null` to remove a preHook, but the update tool action only declares `Type.Optional(Type.Object(...))` — there is no sentinel value and the description doesn't mention clearing. By contrast, `failureAlert` uses `Type.Unsafe<Record<string, unknown> | false>` with an explicit description to clear via `false`. An agent that adds a preHook through the tool has no documented path to remove it. Consider mirroring that pattern and documenting the clear sentinel in the description.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat(cron): add preHook gate for pre-run..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be89f6c662
ℹ️ 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".
517fc08 to
ab19c97
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab19c9758e
ℹ️ 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".
ab19c97 to
d6fd61b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6fd61b610
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66e84a01fd
ℹ️ 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".
66e84a0 to
dae1753
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dae1753818
ℹ️ 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".
b75b011 to
d3ab8a5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d3ab8a5905
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48357cd291
ℹ️ 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".
cec1e73 to
86c3736
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86c3736e89
ℹ️ 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".
44b9da9 to
59cc02b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59cc02b92f
ℹ️ 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".
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: the preHook idea is useful but this stale, conflicting PR is no longer the right landing vehicle; the remaining cron-hook API and security decision is tracked by the canonical open issue. Canonical path: Keep the remaining design on #9465 and land a fresh, security-reviewed implementation only after maintainers choose the permanent cron-hook API and execution boundary. So I’m closing this here and keeping the remaining discussion on #9465. Review detailsBest possible solution: Keep the remaining design on #9465 and land a fresh, security-reviewed implementation only after maintainers choose the permanent cron-hook API and execution boundary. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is a new feature request. The PR review blockers are source-reproducible from PR head: Is this the best way to solve the issue? No. A deterministic pre-run gate is plausible, but this branch is not the best solution now because it is conflicting, updates an obsolete protocol path, and leaves process-execution security and cleanup semantics unresolved. Security review: Security review needs attention: The PR introduces a security-sensitive local process execution surface with an unenforced path contract and weaker timeout cleanup than current cron command execution.
AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 8682d0701b27. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Adds an optional
preHookconfiguration for cron jobs and heartbeat triggers that runs a shell command before agent execution. This gates agent runs on system preconditions (disk space, network, API availability) — eliminating wasteful runs on resource-constrained hosts.consecutiveErrorsstays at 0)consecutiveErrors, triggers backoff/alerts)Config example (cron)
Config example (heartbeat)
Changes
src/cron/pre-hook.ts— core preHook runner with cross-platform shell support, timeout, maxBuffer handling, AbortSignal forwardingsrc/cron/pre-hook.test.ts— 9 tests covering all exit pathspreHookfield onCronJobBase(flows to CronJob/Create/Patch), heartbeat config, zod schemaexecuteJobCore()before session-target dispatch; AbortSignal propagated from timer through server-cron bridge to heartbeat runnerCronPreHookSchemaadded to CronJob, CronAdd, CronJobPatch (nullable in patch)preHookinCRON_RECOVERABLE_OBJECT_KEYSand both add/update tool schemasReview feedback addressed (from prior PRs #17529, #49415, #53789, #54239)
Closes #62185
Test plan
pnpm test src/cron/pre-hook.test.ts— 9/9 passingpnpm test src/cron/normalize.test.ts— 60/60 passing (10 new preHook tests)pnpm check— no new errors (12 pre-existing on main)pnpm test— full suitepreHook: { command: "exit 0" }→ job runspreHook: { command: "exit 10" }→ job skipped, no error countpreHook: { command: "exit 1" }→ job blocked, errors increment