Skip to content

chore: promote staging to staging-promote/4b6d52e5-25011988667 (2026-04-27 20:31 UTC) - #2998

Merged
henrypark133 merged 1 commit into
mainfrom
staging-promote/e7d9922c-25016769392
Apr 29, 2026
Merged

henrypark133 merged 1 commit into
mainfrom
staging-promote/e7d9922c-25016769392

Conversation

@ironclaw-ci

@ironclaw-ci ironclaw-ci Bot commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Auto-promotion from staging CI

Batch range: 7fb41555a9e55677d1aaea29ca567a5b369c2b05..e7d9922ce0885081f28373109da28953ad1d5dec
Promotion branch: staging-promote/e7d9922c-25016769392
Base: staging-promote/4b6d52e5-25011988667
Triggered by: Staging CI batch at 2026-04-27 20:31 UTC

Commits in this batch (95):

Current commits in this promotion (1)

Current base: staging-promote/4b6d52e5-25011988667
Current head: staging-promote/e7d9922c-25016769392
Current range: origin/staging-promote/4b6d52e5-25011988667..origin/staging-promote/e7d9922c-25016769392

Auto-updated by staging promotion metadata workflow

Waiting for gates:

  • Tests: pending
  • E2E: pending
  • Claude Code review: pending (will post comments on this PR)

Auto-created by staging-ci workflow

* fix(engine): make mission threads_today reset timezone-aware

The daily-budget reset added in #2570 compared `last_fire_at.date_naive()`
against `now.date_naive()`, both in UTC. Cron missions configured with a
non-UTC timezone (e.g. `America/Los_Angeles`) expect their budget to
refresh at the user's local midnight, not at 00:00 UTC — under the old
logic such a mission could stay stuck at "exhausted" for up to ~17 hours
into the new local day.

Extract the staleness check into `threads_today_is_stale(&mission)` and
use the mission's cron timezone (when set) for the day boundary; UTC
remains the fallback for manual / event-driven cadences and for cron
missions without a configured timezone.

Tests:
- cron_mission_threads_today_resets_via_tick locks in the tick + cron
  path; the existing reset test only covered fire_on_system_event.
- threads_today_resets_at_cron_local_midnight uses Pacific/Auckland to
  produce a `last_fire_at` that is yesterday-local but same UTC day,
  which the old logic would not have reset.
- threads_today_is_stale_predicate covers the boundary helper directly.

Fixes #1945

* review: address reviewer feedback on threads_today_is_stale

- Inject `now: DateTime<Utc>` into `threads_today_is_stale` so the
  predicate is unit-testable against fixed instants and so the call
  site can pin a single timestamp across the staleness check and the
  cooldown check (Gemini, Copilot).
- Capture `now` once at the top of the staleness/cooldown block in
  `fire_mission` and reuse it for the cooldown comparison so the two
  cannot disagree across a midnight tick.
- Reword the helper doc to drop the hard-coded "5 PM local" claim,
  which varies under DST (Copilot).
- Consolidate the prior wall-clock-based Auckland integration test
  into deterministic synthetic-instant cases inside
  `threads_today_is_stale_predicate`. The previous test could pass
  even when the timezone branch was disabled, depending on when of
  day it ran (Copilot). The new case asserts: same UTC date, but
  Auckland local dates straddle the boundary — exactly the regression
  the timezone branch fixes.
- Document why `last_fire_at = None` with a non-zero counter must
  return `true` (recovery direction), not `false` — `false` would
  re-introduce the permanent-exhaustion bug this helper exists to fix.
@github-actions github-actions Bot added size: L 200-499 changed lines risk: low Changes to docs, tests, or low-risk modules contributor: core 20+ merged PRs labels Apr 27, 2026
@claude

claude Bot commented Apr 27, 2026

Copy link
Copy Markdown

Code review

Found 2 minor issues:

  1. [LOW:MEDIUM] Missing inline comment explaining .tz() safety guarantee

    https://github.com/anthropics/ironclaw/blob/38774202a4bdb84e8fea8e3e9f3b8e74d8d9c0e3/crates/ironclaw_engine/src/runtime/mission.rs#L157-L162

    Line 161 calls .tz() on a ValidTimezone assuming it's infallible. Add a one-line comment documenting that ValidTimezone::parse ensures this is safe (e.g., // ValidTimezone::parse ensures .tz() is safe). Helps readers understand the invariant.

  2. [LOW:MEDIUM] Test case uses wall-clock relative timestamps instead of fixed synthetic times

    https://github.com/anthropics/ironclaw/blob/38774202a4bdb84e8fea8e3e9f3b8e74d8d9c0e3/crates/ironclaw_engine/src/runtime/mission.rs#L7410-L7412

    The test ties state setup to wall-clock time. If execution spans a midnight boundary (unlikely but possible), the relative offset could flip. Use fixed synthetic timestamps instead (e.g., let base = chrono::Utc.with_ymd_and_hms(2026, 4, 27, 12, 0, 0).unwrap();). Matches the pattern in threads_today_is_stale_predicate() and removes timing dependency.


Strengths:

  • ✓ Security: TOCTOU bug fixed by pinning now once across both checks
  • ✓ No panics, unwrap(), or unhandled errors in production code
  • ✓ Excellent test coverage with comprehensive timezone boundary cases
  • ✓ Proper extraction of testable pure function; follows "test through the caller" rule
  • ✓ Logging levels correct (debug! for internals, no info! that would corrupt REPL)
  • ✓ Type-driven design respected (ValidTimezone, enums, newtypes)
  • ✓ Performance acceptable: timezone conversion is O(1), single call per fire

Base automatically changed from staging-promote/4b6d52e5-25011988667 to main April 29, 2026 04:09
@henrypark133
henrypark133 merged commit e7d9922 into main Apr 29, 2026
52 of 67 checks passed
@henrypark133
henrypark133 deleted the staging-promote/e7d9922c-25016769392 branch April 29, 2026 04:09

This branch had an error being deployed

2 failed and 4 inactive deployments
cosmose-ironclaw / production — e7d9922c Deployed Apr 27, 2026 by railway-app[bot]
Ironclaw-QA / production — e7d9922c Deployed Apr 27, 2026 by railway-app[bot]
Near Foundation Ironclaw / production — e7d9922c Deployed Apr 27, 2026 by railway-app[bot]
ironclaw-nearai / production — e7d9922c Deployed Apr 27, 2026 by railway-app[bot]
venice-ironclaw / production — e7d9922c Deployed Apr 27, 2026 by railway-app[bot]
humble-cat / staging-cameron — e7d9922c Deployed Apr 27, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: low Changes to docs, tests, or low-risk modules size: L 200-499 changed lines staging-promotion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants