Skip to content

Pick a random problem cycles only through overdue attempts while unseen problems remain #210

Closed

Description

@jiawei110

Description

Observed behavior

When at least two previously attempted problems are due for review, clicking "Pick a random problem" selects only among those problems. With exactly two due problems, the button alternates between them indefinitely, even when unseen problems exist at the selected difficulty. Changing difficulty may still select an overdue problem outside the selected difficulty.

The random number generator is working. The candidate pool is restricted before the random draw.

Expected behavior

An explicit "Pick a random problem" action should allow new problems at the selected difficulty to be chosen. Automatic spaced-review recommendations can still prioritize overdue attempts, but the explicit random button should not silently inherit a queue that permanently excludes unseen problems.

Reproduction

  1. Have two distinct Easy problems with saved scored attempts at least one day old. For example, give each problem a single HIRE result from two days ago. NO_HIRE attempts can become due too.
  2. Leave additional Easy problems unattempted and select Easy in the lobby.
  3. Click "Pick a random problem" repeatedly without completing another interview.
  4. The two due problems alternate; unseen Easy problems are never selected.

Version & environment

OS: Window 10
Browser: Microsoft Edge Version 154.0.4258.48 (Official build) (64-bit)
CodeTrial: latest with commit 417b2c2

Cause

  • web/app.js:176: the random button updates roll, sets avoidedProblem to the current problem, and calls recommend().
  • web/app.js:880: recommend() calls the same pickProblem() used for review recommendations, with the saved reports.
  • web/problem-picker.js:168: due is built from the whole problem bank, including difficulties not selected.
  • web/problem-picker.js:171: the picker chooses the first nonempty pool from [due, fresh, eligible], after excluding only the current problem.

With two due problems, the due pool always contains the other problem. The fresh pool is never considered. Clicking does not change the attempt timestamps or due status, so repeated clicks cannot escape the queue.

This test explicitly assert that due reviews take priority over unseen problems and may cross difficulty filters. The behavior is therefore an intentional recommendation policy applied to a button labeled as a random choice, rather than a broken RNG or missing history fetch.

Suggestion Improvement

Give explicit random selection its own policy, either through a separate helper or an explicit picker mode. Keep overdue-review priority for the initial automatic recommendation. For the random button, build the pool from the selected difficulties and exclude the current problem whenever another eligible problem exists. Draw uniformly from that pool so every eligible unseen problem has a chance of selection.

If the intended action is specifically to discover new exercises, offer a clearly labeled "Pick an unattempted problem" action instead. That pool should exclude every previously attempted problem, including NO_HIRE and incomplete attempts; the current fresh pool excludes only HIRE results. Fall back to all eligible problems when no unattempted problem remains and explain that fallback in the recommendation text.

Activity

  1. Krixi0828 commented on Oct 2, 2026

    @Krixi0828

    I observed the same behavior on macOS. I also found that the selected difficulty filter was ignored in my test.

    Steps I tried

    1. I selected only Medium difficulty.
    2. Easy and Hard were not selected.
    3. I clicked Pick a random problem 10 times without starting an interview.
    Image

    Results

    The selected problems were:

    1. Sorted Schedule Slot — Easy
    2. Dungeon Route Budget — Easy
    3. Sorted Schedule Slot — Easy
    4. Dungeon Route Budget — Easy
    5. Sensor Calibration Index — Easy
    6. Dungeon Route Budget — Easy
    7. Sorted Schedule Slot — Easy
    8. Sensor Calibration Index — Easy
    9. Dungeon Route Budget — Easy
    10. Sorted Schedule Slot — Easy

    All 10 selections were Easy problems marked as Review due after 1 day, even though I had selected only Medium difficulty.

    No Medium problem was selected during these 10 attempts.

    This behavior seems consistent with the analysis in this issue that overdue review problems are considered before the difficulty-filtered problem pool.

    From a user's perspective, I would expect Pick a random problem to respect the currently selected difficulty. Review recommendations could still prioritize overdue problems separately, but an Easy problem should not be selected when only Medium is checked.

  2. jserv commented on Oct 4, 2026

    @jserv
    Contributor

    @jiawei110 The cause you found holds on main: pickProblem builds due from the whole bank (web/problem-picker.js:168) and tries it before fresh, so two due reviews alternate forever and ignore the difficulty filter, which @Krixi0828 also saw. The due-first rule is deliberate for the recommendation shown when the lobby opens (tests/browser/problem-picker.test.js:34), and that stays. "Pick a random problem" should mean what it says: draw uniformly from the problems at the checked difficulties, excluding the one on screen when another exists. A separate "Pick an unattempted problem" button is not needed for this. A pull request that gives the button its own pool, with a test that two due reviews no longer lock it, is welcome.

  3. Ericko00o commented on Oct 6, 2026

    @Ericko00o
    Contributor

    I'm working on #210. I've separated explicit random selection from the initial due-first recommendation. The random button now draws uniformly from the checked difficulties, excluding the current problem when alternatives exist.
    I'll add unit and browser regression tests covering the two-overdue-review case, difficulty filtering, and page restoration. I'm reviewing the changes before opening a PR.

  4. added a commit that references this issue on Oct 11, 2026
    0d0a265
  5. reopened this on Oct 11, 2026
  6. jserv commented on Oct 11, 2026

    @jserv
    Contributor

    Reopening: the cause found here still holds on main (pickProblem tries the due pool, built from reviewProblems, before fresh), and open PR #256 fixes it with Closes #210, so its merge will close this. @jiawei110, if you closed it because something else resolved it for you, post the output of codetrial --version and what you saw.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions