Skip to content

Protect queueable issues from stale automation#248

Open
brokemac79 wants to merge 2 commits into
openclaw:mainfrom
brokemac79:fix/issue-247-queueable-stale-protection
Open

Protect queueable issues from stale automation#248
brokemac79 wants to merge 2 commits into
openclaw:mainfrom
brokemac79:fix/issue-247-queueable-stale-protection

Conversation

@brokemac79
Copy link
Copy Markdown
Contributor

@brokemac79 brokemac79 commented Jun 2, 2026

Summary

  • Add ClawSweeper-side stale protection for high-confidence queueable issue advisory syncs.
  • When ClawSweeper marks an issue clawsweeper:queueable-fix, it now removes stale and adds the target repo's durable no-stale exemption.
  • Preserve existing manually-applied no-stale labels, but clear the no-stale exemption if a later advisory sync removes a previously queueable ClawSweeper state.
  • Document the advisory-label stale transition in docs/work-lane.md.

Fixes #247.

Companion OpenClaw stale-workflow fix: openclaw/openclaw#89572

Real behavior proof

  • Behavior addressed: ClawSweeper queueable/actionable issue labels should protect actionable OpenClaw issues from stale automation instead of leaving stale attached.
  • Real environment tested: Local openclaw/clawsweeper source checkout on Node v24.13.0, branch fix/issue-247-queueable-stale-protection, head ddbee54177, based on upstream 9c50a95427c21d5e0e33e57295e68b1548cc9953.
  • Exact steps run after this patch:
    • git diff --check
    • node --test --test-name-pattern "issue advisory labels" test/clawsweeper.test.ts
    • node --test --test-name-pattern "apply-decisions counts advisory label-only syncs" test/clawsweeper.test.ts
    • pnpm run build:all
    • pnpm run lint
    • pnpm exec oxfmt --check docs/work-lane.md src/clawsweeper.ts test/clawsweeper.test.ts
    • codex review --uncommitted before committing the patch
  • Evidence after fix:
    • Advisory label tests passed: queueable issue state removes stale, adds no-stale, keeps clawsweeper:queueable-fix, and does not stale-proof lower-confidence/manual-review/PR states.
    • Apply-decisions label-only sync test passed and now asserts the live sync path creates no-stale, adds it, and removes stale for the queueable candidate.
    • Build and lint passed.
    • Changed-file formatting passed.
    • Codex review reported no actionable correctness issues.
  • What was not tested: No live GitHub labels were mutated from this local run.
  • Proof limitation: Full pnpm run check was attempted. It passed active-surface, limits, build, and lint, then failed in broad test:unit on this Windows desktop because unrelated tests spawn local Codex or /usr/bin/git paths (spawnSync codex EPERM, spawnSync /usr/bin/git ENOENT) and one Windows file-mode expectation differs. The focused tests requested by ClawSweeper for this issue passed.

Verification

git diff --check
node --test --test-name-pattern "issue advisory labels" test/clawsweeper.test.ts
node --test --test-name-pattern "apply-decisions counts advisory label-only syncs" test/clawsweeper.test.ts
pnpm run build:all
pnpm run lint
pnpm exec oxfmt --check docs/work-lane.md src/clawsweeper.ts test/clawsweeper.test.ts
codex review --uncommitted

Duplicate scan before opening PR found no open matching implementation PRs in openclaw/clawsweeper for queueable/stale/no-stale protection.

Additional controlled dry-run proof

After ClawSweeper review asked for a non-mocked live/dry-run label-sync proof, I ran a controlled dry-run against live GitHub issue metadata from openclaw/openclaw#78640. This issue currently has stale, clawsweeper:queueable-fix, clawsweeper:source-repro, and clawsweeper:fix-shape-clear.

No live label mutation was performed. The dry-run used a temporary local items/78640.md report with work_candidate: queue_fix_pr, work_status: candidate, work_confidence: high, and the issue's current item_updated_at from GitHub.

Command run:

node dist/clawsweeper.js apply-decisions --target-repo openclaw/openclaw --items-dir C:\oc-work\proof-248-20260602200913\items --closed-dir C:\oc-work\proof-248-20260602200913\closed --plans-dir C:\oc-work\proof-248-20260602200913\plans --report-path C:\oc-work\proof-248-20260602200913\apply-report.json --limit 1 --processed-limit 1 --close-delay-ms 0 --item-numbers 78640 --apply-kind issue --dry-run --progress-every 1

Live labels before the dry-run:

[
  "stale",
  "P1",
  "clawsweeper:fix-shape-clear",
  "clawsweeper:queueable-fix",
  "clawsweeper:source-repro",
  "impact:session-state",
  "impact:data-loss",
  "issue-rating: ?? diamond lobster"
]

Built ClawSweeper label transition computed from those live labels and the queueable issue state:

{
  "beforeContainsStale": true,
  "beforeContainsNoStale": false,
  "afterContainsStale": false,
  "afterContainsNoStale": true,
  "added": ["no-stale"],
  "removed": ["stale"],
  "afterLabels": [
    "P1",
    "impact:session-state",
    "impact:data-loss",
    "no-stale",
    "issue-rating: ?? diamond lobster",
    "clawsweeper:source-repro",
    "clawsweeper:queueable-fix",
    "clawsweeper:fix-shape-clear"
  ]
}

Dry-run apply output:

[apply] 2026-06-02T19:09:16.148Z starting apply: files=1 dry_run=true apply_kind=issue min_age=0 days apply_close_reasons=all stale_min_age_days=60 close_delay_ms=0 sync_comments_only=false comment_sync_min_age_days=0 max_runtime_ms=0 item_numbers=78640 closed=0/1 processed=0/1 counts={}
[apply] 2026-06-02T19:09:17.317Z synced review comment #78640 closed=0/1 processed=1/1 counts={"review_comment_synced":1}
[apply] 2026-06-02T19:09:17.318Z finished apply closed=0/1 processed=1/1 counts={"review_comment_synced":1}
[
  {
    "number": 78640,
    "action": "review_comment_synced",
    "reason": "would update durable Codex review comment"
  }
]

Live labels after the dry-run matched the before labels exactly, so liveMutationsPerformed: false.

The apply result reports the durable-comment dry-run action first because the synthetic local report did not match the existing durable ClawSweeper comment body on the live issue. The label transition above is from the built PR code using the live issue labels and the same queueable issue advisory state used by the apply path; it shows the intended label mutation precisely: add no-stale, remove stale.

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 2, 2026

Codex review: needs maintainer review before merge. Reviewed June 2, 2026, 3:23 PM ET / 19:23 UTC.

Summary
The PR updates ClawSweeper issue advisory-label sync, focused tests, and work-lane docs so high-confidence queueable issues remove stale and gain no-stale.

Reproducibility: yes. Source inspection on current main shows queueable advisory labels are added while unrelated labels such as stale are preserved, and the linked report provides live examples where stale coexists with queueable ClawSweeper labels.

Review metrics: 2 noteworthy metrics.

  • Changed files: 3 files affected. The PR touches the apply-side label-sync code, work-lane documentation, and focused regression coverage.
  • Automation path changed: 1 issue advisory sync path changed. The changed path can mutate live issue labels in target repositories, so rollout review matters even with green tests.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

Risk before merge

  • [P1] Merging changes live issue label-sync automation by creating or adding no-stale and removing stale in target repositories.
  • [P1] The related OpenClaw stale-workflow PR at Fix stale exemptions for ClawSweeper actionable labels openclaw#89572 is still open, so maintainers should decide whether to land this independently or coordinate both repositories.

Maintainer options:

  1. Land With Rollout Awareness (recommended)
    Maintainers can merge this after confirming target repositories already respect no-stale or intentionally staging this before Fix stale exemptions for ClawSweeper actionable labels openclaw#89572.
  2. Pause For Companion Workflow
    If stale behavior should change as one coordinated rollout, pause this PR until the companion OpenClaw workflow PR is reviewed and ready.
  3. Ask For Broader Dry-Run Output
    If maintainers want the apply output itself to reach advisory-label sync first, ask for a dry-run where the durable comment already matches so the label sync action is reported directly.

Next step before merge

  • [P2] Human review is needed for live automation rollout timing and companion stale-workflow coordination; I found no narrow automated repair defect.

Security
Cleared: The diff changes first-party label-sync logic, docs, and tests only; I found no concrete security or supply-chain concern.

Review details

Best possible solution:

Land the narrow ClawSweeper label-sync change after maintainers accept the stale-label rollout timing with the companion OpenClaw workflow PR.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection on current main shows queueable advisory labels are added while unrelated labels such as stale are preserved, and the linked report provides live examples where stale coexists with queueable ClawSweeper labels.

Is this the best way to solve the issue?

Yes. The patch keeps stale protection inside the existing advisory-label sync path, adds focused coverage, and documents the ownership boundary without introducing a new workflow or config surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9c50a95427c2.

Label changes

Label justifications:

  • P2: This is a normal-priority automation reliability fix with limited blast radius to ClawSweeper issue label sync.
  • merge-risk: 🚨 automation: Merging changes live label-sync automation by adding/removing stale-related labels in target repositories.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix controlled dry-run/live-output evidence showing the intended stale-to-no-stale transition without mutating GitHub labels.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix controlled dry-run/live-output evidence showing the intended stale-to-no-stale transition without mutating GitHub labels.
Evidence reviewed

What I checked:

  • Repository policy read and applied: AGENTS.md was read fully; its automation-safety guidance applies because the PR changes apply-lane label mutation behavior. (AGENTS.md:1, 9c50a95427c2)
  • Current main lacks stale protection: On current main, nextIssueAdvisoryLabels removes only owned issue advisory labels and appends wanted advisory labels, so unrelated stale is preserved and no no-stale label is added. (src/clawsweeper.ts:9267, 9c50a95427c2)
  • Current sync mutates only advisory labels: Current syncIssueAdvisoryLabels only adds/removes labels recognized by isIssueAdvisoryLabel, so the existing apply path cannot create no-stale or remove stale. (src/clawsweeper.ts:9429, 9c50a95427c2)
  • PR diff implements the requested transition: The PR diff adds stale/no-stale constants, queueable stale-protection helpers, no-stale label creation support, and sync logic to add no-stale and remove stale for queueable issue advisory states. (src/clawsweeper.ts:1311, e6e4eb4a47d7)
  • Regression coverage added: The PR diff adds focused tests for apply-side label sync, queueable issue stale protection, non-queueable preservation, manual-review behavior, and pull-request exclusion. (test/clawsweeper.test.ts:12540, e6e4eb4a47d7)
  • Linked issue demonstrates the gap: The linked report describes live OpenClaw examples where stale coexists with clawsweeper:queueable-fix, clawsweeper:source-repro, and clawsweeper:fix-shape-clear.

Likely related people:

  • Tak Hoffman: Blame and git log -S show the current issue advisory-label implementation and work-lane docs originated in commit 3b76d34e75b9dc2618541be069c80078124ebbe9, and recent proof-nudge automation commits also touch the same main/test surface. (role: introduced behavior and recent area contributor; confidence: high; commits: 3b76d34e75b9, 9c50a95427c2, 71e4da1fa1a5; files: src/clawsweeper.ts, test/clawsweeper.test.ts, docs/work-lane.md)
  • Dallin Romney: Commit 50ca51d85c236e32c28690c494f907e4108ca317 changed repair-lane gating and concurrency in the same main/test files that feed queueable work-lane state. (role: adjacent repair-lane contributor; confidence: medium; commits: 50ca51d85c23; files: src/clawsweeper.ts, test/clawsweeper.test.ts)
  • brokemac79: Beyond this PR, prior merged commits by this contributor touched ClawSweeper automation source/tests, including proof nudges and issue-author command parsing. (role: recent adjacent contributor with prior merged history; confidence: medium; commits: 9b08258b9c64, 485f71abc664, a07fc1f94275; files: src/clawsweeper.ts, test/clawsweeper.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 2, 2026
@brokemac79
Copy link
Copy Markdown
Contributor Author

Coordination note: Shadow (OpenClaw admin) mentioned in Discord that this stale/queueable behavior may be intentional.

Keeping this PR open for now while maintainers confirm the intended policy. If it is confirmed intentional that ClawSweeper queueable/actionable issues can still be marked stale, maintainers can close this PR. If not, this remains the proposed fix path.

Copy link
Copy Markdown
Contributor Author

Coordination note: Shadow (OpenClaw admin) mentioned in Discord that this stale/queueable behavior may have been intentional.

I’m leaving this PR open for now so maintainers can confirm the intended policy. If the intended policy is that ClawSweeper queueable/actionable issues may still be marked stale and remain eligible for stale handling, maintainers can close this PR as intentional / not planned.

If the intended policy is that queueable/actionable ClawSweeper issues should be protected from stale closure, this PR remains the proposed fix path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ClawSweeper queueable labels do not protect actionable OpenClaw issues from stale automation

1 participant