Skip to content

fix(login): require weekly reset drift before auto-start - #33

Merged
Pimpmuckl merged 1 commit into
mainfrom
hotfix/weekly-window-drift-only
Jul 12, 2026
Merged

fix(login): require weekly reset drift before auto-start#33
Pimpmuckl merged 1 commit into
mainfrom
hotfix/weekly-window-drift-only

Conversation

@Pimpmuckl

Copy link
Copy Markdown
Owner

Summary

  • auto-start only when a dated 100% weekly window is observed twice and its end date moves forward
  • remove resetless, activity-rearm, suppression, and recovery-generation eligibility paths
  • retain locking, crash closure, and retry backoff as operational safeguards

Validation

  • focused codex-login weekly-window state tests: 4 passed, 207 skipped
  • just fmt
  • git diff --check

Live evidence boundary

Manual account acknowledgements occurred during observation, so live account activation is not treated as proof. Deterministic state tests own this behavior.

@Pimpmuckl
Pimpmuckl force-pushed the hotfix/weekly-window-drift-only branch 2 times, most recently from ebfc856 to 38c3178 Compare July 12, 2026 20:02
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38c31786b0

ℹ️ 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".

Comment thread codex-rs/login/src/codex_plus_plus/weekly_window_state.rs Outdated
@Pimpmuckl
Pimpmuckl force-pushed the hotfix/weekly-window-drift-only branch from 38c3178 to 3d980dc Compare July 12, 2026 20:17
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d980dc90b

ℹ️ 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".

Comment thread codex-rs/login/src/codex_plus_plus/weekly_window_state.rs Outdated
@Pimpmuckl
Pimpmuckl force-pushed the hotfix/weekly-window-drift-only branch from 3d980dc to dd1b826 Compare July 12, 2026 20:31
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd1b826c56

ℹ️ 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".

Comment on lines 248 to 250
if resets_at < attempt_reset_at {
return None;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject retry drifts older than the latest observation

When a retryable attempt has already seen a later reset during backoff, this only rejects values older than the original attempt. For example, after failing at reset 10, a backoff scan at reset 12 updates last_observed_reset_at, but a later response at reset 11 still passes here and becomes a new identity, so fluctuating rate-limit data can auto-start a regressed/stale window. Compare new retry identities against the latest observed reset while still allowing the original retry identity.

Useful? React with 👍 / 👎.

Comment on lines +271 to +272
if previous.is_none() || was_active {
return None;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve active observations during stale-dispatch recovery

This first-zero guard depends on last_observed_active, but stale dispatch recovery never records active usage: if a process crashes after setting Dispatching and the next scan sees unused=false, begin_weekly_window_attempt closes the old attempt and returns before reaching this branch. The following scan with a larger exact-zero reset then has was_active == false and dispatches on its first zero observation, contrary to the new drift predicate after active usage.

Useful? React with 👍 / 👎.

@Pimpmuckl
Pimpmuckl force-pushed the hotfix/weekly-window-drift-only branch 3 times, most recently from cc40f37 to 917147a Compare July 12, 2026 21:13
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 917147a900

ℹ️ 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".

const MAX_STATE_BYTES: u64 = 4 * 1024;
const SUPPRESSION_SECONDS: i64 = 7 * 24 * 60 * 60;
const MAX_FAILURE_COUNT: u8 = 8;
const STATE_VERSION: u8 = 2;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep weekly-window state readable by older builds

Bumping STATE_VERSION makes every newly written weekly-window-state.json use version 2, while the previous reader rejects anything other than version 1 as incompatible even though the serialized fields did not change here. In a rollback or mixed-version install after a new build scans an account, the old scheduler will treat the account state as unavailable and stop auto-starting until the file is manually removed; keep the on-disk version at 1 or provide a compatibility path before writing v2.

Useful? React with 👍 / 👎.

Comment on lines +187 to +191
fn missing_reset_never_dispatches() {
let (_home, store, id) = test_store(/*automation_enabled*/ true);
assert_not_due(&store, &id, usage(UNUSED, None), 0);
assert_not_due(&store, &id, usage(ACTIVE, None), 1);
assert_not_due(&store, &id, usage(UNUSED, None), i64::MAX);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the negative resetless-path test

This test only locks in that resetless weekly usage can never dispatch, which is negative coverage for the resetless eligibility path this commit removed. /workspace/codex/AGENTS.md says Do not add negative tests for logic that was removed, so this should be dropped or replaced with positive coverage of the remaining dated reset-drift behavior.

Useful? React with 👍 / 👎.

@Pimpmuckl
Pimpmuckl force-pushed the hotfix/weekly-window-drift-only branch from 917147a to 2bb454b Compare July 12, 2026 21:27
@Pimpmuckl

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 2bb454bc55

ℹ️ 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".

@Pimpmuckl
Pimpmuckl merged commit e951c75 into main Jul 12, 2026
@Pimpmuckl
Pimpmuckl deleted the hotfix/weekly-window-drift-only branch July 12, 2026 21:44
Pimpmuckl added a commit that referenced this pull request Jul 13, 2026
fix(login): require weekly reset drift before auto-start
Pimpmuckl added a commit that referenced this pull request Jul 14, 2026
fix(login): require weekly reset drift before auto-start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant