Skip to content

Make Session.retire() terminal #2312

Closed

Description

@vdusek

Session.retire() only adds max_error_score to the error score (sessions/_session.py), and mark_good() lowers the score again. A fresh session that gets retired reaches a score of 3.0, and one mark_good() brings it down to 2.5, which makes it usable again.

Make retirement terminal, as in JS v4: add a retired flag that is_usable and is_blocked respect, persist it in SessionModel, and make the pool never hand out a retired session.

This will be a breaking change.

JS implementation: apify/crawlee#3643. Related: apify/crawlee#4165 (add_session replaces a retired session).

✍️ Drafted by Claude Code

Activity

  1. added this to the 2.0 milestone on Oct 13, 2026
  2. added
    t-toolingIssues with this label are in the ownership of the tooling team.
    debtCode quality improvement or decrease of technical debt.
    on Oct 13, 2026
  3. linked a pull request that will close this issuefix(sessions)!: Never reuse a retired session #2348on Oct 29, 2026
  4. added a commit that references this issue on Oct 29, 2026
    57740f4
  5. self-assigned this
    on Oct 29, 2026
  6. vdusek commented on Oct 29, 2026

    @vdusek
    CollaboratorAuthor

    resolved by #2348

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

Metadata

Metadata

Assignees

Labels

debtCode quality improvement or decrease of technical debt.t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions