Skip to content

ADR 0040 step 4 — Settle an expired session lifetime once #4968

Open

Description

@thymikee

Make the sweep, owner request, and successor share one expiry job.

ADR 0040

Required behavior

  • Register settleExpiredLifetime(lifetimeId) before its first asynchronous operation. Use a lease end record for its sessions, retained host, and provider release.
  • Check expiry under lock. When settlement is required, return a wait instruction, drop locks, await within the request budget, and replan.
  • If a step holds outer locks, refuse through the step contract and unwind. Never re-enter the held lock.
  • Allow only open with its own valid lease to replace an expired lifetime. Recheck the lease after the wait. Delete inline teardown, successor dispatch, and early successor renewal.
  • Clear a claim only when settlement proves safe reuse.

Verification

Use a fake clock and barriers for close versus sweep, two successors, wait with and without --wait, owner and successor cancellation, lease expiry during the wait, hold drain, and bounded step unwind. Verify one teardown and one report of a confirmed lease end.

Related work

Use the double teardown work in #4949. Keep the immediate progress and credential regression cases from #4944.

Depends on the lifetime admission boundary in step 1.

Activity

  1. apex-sentinel-staging commented on Nov 22, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: feature

    The issue specifies an implementation task from an ADR with required behavior, verification cases, and dependencies, requesting new/idempotent expiry settlement behavior rather than reporting a current observable defect. The text contains technical instructions for implementers but no attempt to steer the triage response.

    Possible duplicates

  2. thymikee commented on Nov 22, 2026

    @thymikee
    MemberAuthor

    When this step lands, amend the ADR that ADR 0040 (#4964) lists for it in its Amendments table, in the same PR. ADR 0040 does not edit those ADRs up front, because an ADR states the current truth and the code has not changed yet.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions