Skip to content

fix(cron): preserve runtime snapshot for isolated delivery#86604

Merged
steipete merged 2 commits into
mainfrom
fix/cron-isolated-discord-runtime-snapshot
May 25, 2026
Merged

fix(cron): preserve runtime snapshot for isolated delivery#86604
steipete merged 2 commits into
mainfrom
fix/cron-isolated-discord-runtime-snapshot

Conversation

@steipete

@steipete steipete commented May 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Resolve isolated cron run preparation against the active runtime config snapshot before deriving agent defaults.
  • Preserve resolved channel credentials for direct delivery, including Discord account tokens backed by SecretRefs.
  • Add regression coverage for isolated Discord delivery after agent-default derivation.

Verification

  • node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner-memory.test.ts extensions/codex/src/app-server/compact.test.ts src/agents/command/cli-compaction.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts extensions/discord/src/token.test.ts src/config/runtime-snapshot.test.ts
  • node scripts/run-vitest.mjs src/cron/isolated-agent.direct-delivery-core-channels.test.ts extensions/discord/src/token.test.ts src/config/runtime-snapshot.test.ts
  • git diff --check
  • /Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode local

Real behavior proof
Behavior addressed: cron isolated Discord delivery keeps using resolved runtime snapshot credentials after agent defaults are rebuilt.
Real environment tested: local source checkout with focused isolated-cron delivery, Discord token, and runtime snapshot tests.
Exact steps or command run after this patch: node scripts/run-vitest.mjs src/cron/isolated-agent.direct-delivery-core-channels.test.ts extensions/discord/src/token.test.ts src/config/runtime-snapshot.test.ts
Evidence after fix: 3 test files passed; 32 tests passed after rebasing on current main. Earlier broad focused proof also passed 7 files and 90 tests.
Observed result after fix: isolated Discord announce delivery receives the runtime snapshot channels config with the resolved token.
What was not tested: live Discord cron delivery was not rerun in this local PR pass.

Fixes #86545

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed May 25, 2026, 2:49 PM ET / 18:49 UTC.

Summary
The PR selects the active runtime config snapshot before deriving isolated cron agent defaults and adds Discord direct-delivery regression coverage.

PR surface: Source +16, Tests +50. Total +66 across 2 files.

Reproducibility: yes. by source inspection: current main rebuilds cfgWithAgentDefaults from input.cfg, which can make Discord token resolution fall back to an unresolved SecretRef instead of the active runtime snapshot. I did not execute the regression test in this read-only review.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
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:

  • Wait for required CI, and consider live Discord cron proof only if maintainers want release-blocker confidence.

Risk before merge

  • Live Discord cron delivery was not rerun in this review; the available proof is focused local tests and source inspection.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow runtime-snapshot cron fix after normal maintainer review and required CI, keeping the regression test with the behavior change.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
This maintainer-labeled implementation PR has no actionable repair finding; the remaining step is maintainer review, CI, and merge decision.

Security
Cleared: The diff only touches cron runtime selection and tests; it adds no dependency, workflow, package, or secret-handling surface beyond preserving the existing runtime snapshot.

Review details

Best possible solution:

Land the narrow runtime-snapshot cron fix after normal maintainer review and required CI, keeping the regression test with the behavior change.

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

Yes, by source inspection: current main rebuilds cfgWithAgentDefaults from input.cfg, which can make Discord token resolution fall back to an unresolved SecretRef instead of the active runtime snapshot. I did not execute the regression test in this read-only review.

Is this the best way to solve the issue?

Yes, the PR uses the existing runtime snapshot selector before agent-default derivation rather than adding a new config path or Discord-specific workaround. The regression coverage targets the reported isolated Discord delivery failure.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P1: The PR fixes a reported regression where isolated cron Discord announce delivery can fail because resolved SecretRef credentials are not preserved.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled PR includes focused local test proof; the external contributor real-behavior-proof gate is not applied to this protected maintainer workflow.

Label justifications:

  • P1: The PR fixes a reported regression where isolated cron Discord announce delivery can fail because resolved SecretRef credentials are not preserved.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled PR includes focused local test proof; the external contributor real-behavior-proof gate is not applied to this protected maintainer workflow.
Evidence reviewed

PR surface:

Source +16, Tests +50. Total +66 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 21 5 +16
Tests 1 51 1 +50
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 72 6 +66

What I checked:

  • Root repository policy read and applied: Full root AGENTS.md was read; its maintainer-label protection and config/auth/message-delivery compatibility guidance shaped the review. No scoped AGENTS.md owns src/cron or src/config directly. (AGENTS.md:1, e844d1d6e56b)
  • Current main still derives cron defaults from source config: Current main's prepareCronRunContext resolves default agent/config overrides from input.cfg and then spreads input.cfg into cfgWithAgentDefaults, which can make the config no longer match the runtime source snapshot after defaults are rebuilt. (src/cron/isolated-agent/run.ts:492, e844d1d6e56b)
  • Runtime snapshot contract explains the failure mode: selectApplicableRuntimeConfig returns the runtime config only when the input config equals or matches the runtime source snapshot; a locally modified copy falls back to the input config. (src/config/runtime-snapshot.ts:209, e844d1d6e56b)
  • Discord token resolution depends on the selected runtime config: Discord token resolution calls selectDiscordRuntimeConfig and reports configured_unavailable for unresolved account SecretRefs, matching the linked issue's observed error path. (extensions/discord/src/token.ts:59, e844d1d6e56b)
  • Patch moves cron preparation onto the runtime snapshot: The PR adds resolveCronActiveRuntimeConfig and uses runtimeCfg for default agent resolution, agent overrides, agent defaults, and cfgWithAgentDefaults. (src/cron/isolated-agent/run.ts:492, 230cf7f49062)
  • Regression test covers resolved Discord channel credentials: The PR sets a source config with an env SecretRef and a runtime config with a resolved Discord token, then asserts direct Discord delivery receives the runtime channels config. (src/cron/isolated-agent.direct-delivery-core-channels.test.ts:321, 230cf7f49062)

Likely related people:

  • steipete: git blame ties the current cron preparation, runtime snapshot selector, and Discord token selection lines to Peter Steinberger, and the PR head is also authored by steipete. (role: current implementation and runtime-snapshot area contributor; confidence: high; commits: 4012ae4f426a, 230cf7f49062; files: src/cron/isolated-agent/run.ts, src/config/runtime-snapshot.ts, extensions/discord/src/token.ts)
  • Vincent Koc: The current main tip is a cron-related fix by Vincent Koc, so he is an adjacent routing candidate if maintainers want another cron-area reviewer. (role: recent adjacent cron contributor; confidence: medium; commits: e844d1d6e56b; files: src/cron/service/timer.regression.test.ts, src/agents/session-suspension.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.

@steipete steipete force-pushed the fix/cron-isolated-discord-runtime-snapshot branch from 39befee to 230cf7f Compare May 25, 2026 18:42
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🌱 uncommon Neon Proofling

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🌱 uncommon.
Trait: hums during re-review.
Image traits: location merge queue dock; accessory proof snapshot camera; palette moss green and polished brass; mood calm; pose curling around a status light; shell paper lantern shell; lighting subtle sparkle highlights; background small review tokens.
Share on X: post this hatch
Copy: My PR egg hatched a 🌱 uncommon Neon Proofling in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@steipete steipete force-pushed the fix/cron-isolated-discord-runtime-snapshot branch from 230cf7f to 5b5d378 Compare May 25, 2026 20:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merge proof for current head 5b5d378:

Local proof:

  • node scripts/run-vitest.mjs src/cron/isolated-agent.model-overrides.test.ts src/cron/isolated-agent.delivery-awareness.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts extensions/discord/src/token.test.ts src/config/runtime-snapshot.test.ts
  • node scripts/run-vitest.mjs src/cron/isolated-agent*.test.ts src/cron/isolated-agent/*.test.ts
  • git diff --check
  • /Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode local

CI proof:

Known proof gap:

  • Live Discord cron delivery was not rerun here; this is source + regression + CI proof for the SecretRef/runtime snapshot path.

@steipete steipete merged commit a98660e into main May 25, 2026
99 checks passed
@steipete steipete deleted the fix/cron-isolated-discord-runtime-snapshot branch May 25, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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]: Cron isolated jobs fail Discord delivery with "SecretRefs not resolved against runtime snapshot" after v2026.5.22

1 participant