factory(watch): nudge linked workflows when an issue's sandbox is collected #1691
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 424 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.362
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1691"
general
weight: 0.35
sdowell
Why
A workflow issue (e.g. KCC's
kcc-greenfield) hands its steps out as issues of their own and checks on them each run, sitting out its cooldown (2h for greenfield) in between. When a step closes, the workflow only notices on its next cooldown-gated run.Example: merging PR #13570 closes step issue #13565. Parent issue #13254 has
wf-issue-13254and tracks #13565 in a progress comment. Nothing on #13565 or its sandbox points back at #13254. The link only shows up as across-referencedevent on #13565's timeline.A second problem made this worse: the PR's tasks ran in
fix-k8s-config-connector-13565(labelledpr=13570). The open-issue cache keeps every issue the watcher has ever worked on, so the closed-issue GC never noticed the merge, and the sandbox stayed around indefinitely.What
sandbox.Reconciler- When it confirms an issue closed, it calls a new
LinkedWorkhook before deleting the sandbox, including in dry-run mode. The reconciler still cannot touch the queue itself.- An issue sandbox whose
factory.gemini.google.com/prlabel names a PR that has left the open-PR cache is now confirmed against GitHub, even though the issue cache still lists the issue as open.issues.Nudger(new, stateless, so safe to call from the reconciler's goroutine):- It gathers the issues that cross-reference the closed one on its timeline, plus the issues its body names.
- For each that has a
wf-issue-Nsandbox, is open, has no stop label and still names a workflow, it queues the workflow run.- The task uses the scanner's own file name (
task-workflow-<slug>-issue-N.yaml), so the queue dedupes against the scanner.- It skips the cooldown and records the new trigger reason
LinkedIssueClosed.- It honours
MinNumberandDryRun.- It is wired in only when the watcher scans issues.
sandbox.Service.Exists: new.Behaviour change
fix-*sandbox that a PR ran in is now deleted about 15 minutes after the PR merges and closes its issue. The first GC after deploy will delete the ones whose PR is already merged.Latency from merge to nudge: at most about 15 minutes (up to 10 for the PR sweep, up to 5 for GC). Previously the wait was up to the workflow's cooldown.
Not covered
Tests
issues/nudge_test.gocovers:- the cross-referencing parent is queued with the right task;
- the near misses are not queued: the PR itself, a closed issue, an issue with no workflow, and an issue with no sandbox;
- an already-queued run is left alone;
- the cooldown is skipped;
- dry-run queues nothing;
-
MinNumberis honoured.sandbox/reconciler_test.gocovers:- the sandbox is collected and reported once its PR leaves the open-PR cache (this test fails without the new check);
- the sandbox is kept, with no GitHub calls, while the PR is open;
- the hook is called in dry-run mode.