Skip to content

test(cli): the near-expiry refusal test no longer flakes at the minute boundary - #3419

Merged
lilyshen0722 merged 1 commit into
mainfrom
cto/f96-expiry-flake
Nov 4, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
cto/f96-expiry-flake

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

What

"a workspace seat whose login would expire mid-turn is refused…" wrote a login expiring exactly 60 s ahead and expected "expires in 0 min". When the check ran in the same millisecond, Math.floor(60000 / 60000) came out as 1, so CI went red once on #3413 and then passed on re-run. The test now sets the expiry 30 s ahead. That is still inside the turn timeout, so the refusal still fires, and the minutes always floor to 0.

Proof

adapters.claude.environment passes locally (108 passed). The one failure, the macOS-only "runs in bwrap with a HOME…" test, fails the same way on main. The flake is arithmetic, not timing-dependent: Math.floor((now + 60000 - now) / 60000) === 1, while Math.floor((now + 30000 - now) / 60000) === 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw

…e boundary

The test wrote a login expiring exactly 60 s ahead and expected "expires in
0 min". When the check ran in the same millisecond, floor(60000 / 60000)
gave "1 min", and CI went red on #3413. 30 s ahead still sits inside the
turn timeout, so the refusal still fires, and the minute always floors to 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MDs9DPFVAooJnqCSwrdxVw

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

HEAD: 2e1e8d0 — GATE: PASS

One quick subagent review. The diagnosis holds: at +60000 a same-millisecond check floors to 1 min, while at +30000 it always floors to 0. The refusal still fires, since mustOutlastMs defaults to 15 min. The only sibling at +60 s (line 1899) does not assert the minute count. The reviewed tree is identical to this head (fdc10be3).

GATE: PASS

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The workspace-seat login-expiry test now sets the expiry to 30 seconds ahead instead of 60 seconds. Its existing assertions are unchanged.

Changes: Login expiry test

Layer / File(s) Summary
Adjust test expiry
cli/__tests__/adapters.claude.environment.test.mjs
The test sets expiresAt to 30 seconds ahead. Its refusal and error-message assertions remain unchanged.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Merge Risk: Minimal · up to 2e1e8

This targeted test adjustment is mergeable with no remaining actionable risk.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly identifies the main change: preventing flakes in the CLI near-expiry refusal test at the minute boundary.
Description check Passed The description directly explains the flaky arithmetic, the 30-second expiry change, the preserved refusal behavior, and the local test results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 00166e0 and 2e1e8d0.

Files selected for processing: 1
  • cli/__tests__/adapters.claude.environment.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 02b9f8b Nov 4, 2026
32 checks passed
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