Repository navigation
feat(pm-stack): rung-4 watchdog escalation hand-off (#6033) - #8357
Conversation
…ask + incident issue, recovery, surfacing (#6033)
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e91ca6ef4
ℹ️ 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".
| escalation: { | ||
| class: health.currentClass ?? "unknown", | ||
| since: at, | ||
| queueTaskId: refs.queueTaskId, | ||
| issueRepo: ctx.issueRepo, |
There was a problem hiding this comment.
Preserve earlier escalation refs when the failure class changes
When an unresolved source changes failure class, planEscalation intentionally creates another handoff, but this assignment replaces the previous class's issue and task references. planRecovery subsequently closes and completes only the latest pair, leaving the earlier issue and task open permanently. If the failure class changes back, the original pair is also forgotten for deduplication and another handoff is created. Preserve the records per class until recovery, or explicitly retire the previous handoff before replacing its references.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the shepherd fix commit on this PR (task 17233) — see the merge-ready note for the per-finding disposition; new regression tests in test/watchdog-escalation.test.ts (25/25 pass across the escalation + state suites).
| case "enqueue_task": | ||
| queueTaskId = await effectors.enqueueTask(action.packet); | ||
| break; | ||
| case "open_issue": | ||
| issueNumber = await effectors.openIssue(action); |
There was a problem hiding this comment.
Retain confirmed effect references when a later action fails
If enqueueTask succeeds but openIssue rejects, this function rejects without returning the confirmed queue task ID. The documented caller therefore cannot pass that reference to recordEscalation, and the next escalation plan still contains both creation actions. Retrying can enqueue duplicate repair work, while the first task has no persisted reference for recovery to complete. Expose and persist partial progress, and have subsequent planning retry only the missing effect rather than requiring both external operations to succeed before recording either.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the shepherd fix commit on this PR (task 17233) — see the merge-ready note for the per-finding disposition; new regression tests in test/watchdog-escalation.test.ts (25/25 pass across the escalation + state suites).
| const incident = health.incident; | ||
| if (!incident) return null; | ||
| if (incident.humanBlocked || incident.surfacing === "human-blocked") { | ||
| return `NEEDS DREW: ${health.source} quota producer is human-blocked (${health.currentClass ?? "unknown"}: ${health.lastDetail || "human-only challenge"}) — incident ${incident.id}`; |
There was a problem hiding this comment.
Surface the persisted human-blocking challenge reason
When a repair encounters a human-only challenge, recordRungOutcome saves the challenge detail in repairLog without updating lastDetail. For example, a producer observation of HTTP 401 followed by a repair failure of passkey required on the laptop makes this line report session-expired: HTTP 401, omitting the intervention actually needed. Subsequent blocked ticks can overwrite lastDetail again while the human-blocked flag remains set. Render the persisted blocking reason rather than the latest producer-observation detail so the human-facing notification identifies the required action.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the shepherd fix commit on this PR (task 17233) — see the merge-ready note for the per-finding disposition; new regression tests in test/watchdog-escalation.test.ts (25/25 pass across the escalation + state suites).
|
agent-note:v1 |
…rtial-progress refs, use persisted challenge reason (Codex P2 x3 on #8357)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
agent-note:v1
|
Implements the rung-4 escalation hand-off for the quota watchdog (issue #6033, design #6031). The decision layer (#6032,
pm-stack/exporters/src/watchdog-state.ts) already decidesescalateonce every rung is spent; this PR adds the effect layer that word stands for, behind injected effectors so the policy is fully testable without a queue, network, or browser — the same layering #6032 used.What lands
src/watchdog-escalation.tsbuildEscalationPacket— the full context packet from impl(pm-stack): quota watchdog escalation — fleet queue task + deduplicated incident issue for a browser-enabled agent #6033: outcome wanted (source produces a freshlatest.jsonwith real quota windows), failure context (class, consecutive failures, the persistedrepairLog, producer history reference, state-file path, adapter reference), required capability (browser-enabled agent; laptop Helium via CDP :19222; adapter origins only), acceptance (fresh producer document lands; the watchdog auto-closes), and the stop conditions (human-only challenge → mark human-blocked; outside the origin allowlist → stop and report on the incident issue).planEscalation— exactly oneenqueue_task+ oneopen_issuefor an escalating incident; returnsdeduped: trueand no actions when the incident already carries an escalation record for the same (source, class) pair.recordEscalation— persists the confirmed queue task id / issue number onto the incident.planRecovery— on producer success: comment the resolution, close the incident issue, complete the queue task (state-side,decide's healthy path clears the incident in the same tick).surfacingLine— the NEEDS DREW line: immediate (same tick) when human-blocked with a one-line reason; for ordinary escalations only after 24 h unresolved (ESCALATION_NEEDS_DREW_AFTER_MS), quiet before that.applyEscalationActions— runs planned actions through the injected effectors in order.src/watchdog-state.ts—Incidentgains an optionalescalationrecord (EscalationRecord);coerceHealthvalidates it structurally and drops malformed records, so older state files keep reading cleanly.test/watchdog-escalation.test.ts— one test per impl(pm-stack): quota watchdog escalation — fleet queue task + deduplicated incident issue for a browser-enabled agent #6033 acceptance criterion (dedup, packet completeness, recovery sequence, human-blocked same-tick surfacing, 24 h quiet period, coercion round-trip), oracle = the acceptance text.Tests
bun test ../exporters/test/watchdog-escalation.test.ts ../exporters/test/watchdog-state.test.tsfrom pm-stack/aggregator: 21 pass, 0 fail (includes the existing #6032 PBT/MBT suites — no regressions).Remaining (owned by the #6032 remainder, noted in the README)
The oneshot entry point (
src/watchdog.tsin exporters) that reads state, callsdecide, and wires the production effectors (fleet CLI enqueue, gh issue create/comment/close) to these planners. This PR deliberately does not invent that host.Links: task 14781 · issue #6033 · design #6031 · core #6032
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.