fix(webllm): a résumé reset fences the stale analysis run but never aborts it
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start in src/hooks/useResumeAnalysisLlm.ts, especially the resetKey effect, AbortReason handling, and catch path; inspect acquireInference in src/lib/webllm/web-llm.ts:380. Add coverage for reset during streaming and model load, verify reset does not report a user abort, and check src/lib/analytics.ts if a reset reason is emitted. Run npm run typecheck and the scoped tests.
Written by the indexing model from the issue text.
Description
Problem
#1100 (for #1099) makes a résumé reset safe for the panel, but it does not stop the stale run. The resetKey effect in src/hooks/useResumeAnalysisLlm.ts bumps runSeqRef and clears inFlightRef. After that, every status write and every telemetry call from the stale run is gated on isCurrent(). It never calls abortControllerRef.current?.abort(...), so a stale run that is past model load keeps generating tokens on the GPU until it finishes or hits its phase deadline.
Because #1100 frees inFlightRef right away, the user can press Analyze on the new résumé while the stale run is still generating. Both runs then drive the same engine. acquireInference is a reference counter, not a lock (src/lib/webllm/web-llm.ts:380), so nothing in our code serializes the two. What happens then is up to web-llm: the new run may queue behind the stale one or the two may interleave. Either way the stale work is wasted, and on a slow device it can use most of a phase deadline.
The comment #1100 added above the reset effect also says the hook has "no AbortController". That was true on #1100's original base but has been false since #1098 merged. After the rebase both mechanisms are in the file.
Proposed fix
- Add an abort reason for a reset (for example
"reset"inAbortReason). In theresetKeyeffect, abort the active controller with that reason alongside the sequence bump. - Keep the
runSeqReffence. It still covers a reset duringloadEngine, which has no cancel path. - In the
catch, a"reset"abort writes no status and does not emittrackAnalysisAbortedwithreason: "user". Either skip the event or emitreason: "reset". If it is emitted, document the new value insrc/lib/analytics.ts. - Correct the reset-effect comment so it describes the actual mechanism: abort plus sequence fence.
Acceptance criteria
- A test resets mid-phase and asserts the active
AbortControllerwas aborted with the reset reason, and that the phase's streaming call received an aborted signal. - A reset during model load still leaves status
idleand never shows the old résumé's findings. The existing #1100 test stays green. - A reset never emits
trackAnalysisAbortedwithreason: "user". A user Stop behaves as #1098 shipped it. - The reset-effect comment no longer says the hook has no AbortController.
-
npm run typecheckand the scoped tests are green.
Dependencies
Follows #1100. Start after it merges.
- Dominant language
- TypeScript
- Stars
- 11
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from offlinecv/OfflineCV
-
fix(heuristics): unit number before a Saint-named city drops "St." from the locationPossibly taken @gaal-agent claimed this 17 days ago. Openbug gaal ux:parsing
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Migrate Gaal implement/review/revise to the local gaal watch; keep mechanical workflows on ActionsOpenarchitecture chore github_actions needs-human ready-for-agent
Difficulty 5/5 Over a week Newbie friendliness 8/100
-
Parser: achievement year lost on re-import when '· YYYY' wrapped to its own linePossibly taken @gaal-agent claimed this 12 days ago. Openbug gaal ready-for-agent ux:parsing
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Export: auto-bolded metric bullets extract one word per line in stream-order parsers (pypdf/Drive)Possibly taken @gaal-agent claimed this 12 days ago. Openbatch:export-standards bug gaal ready-for-agent ux:edit-export
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
bug duplicate improvement
Difficulty 3/5 Half a day Newbie friendliness 66/100
All issues in offlinecv/OfflineCV
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
grafana/profiles-drilldown#1212 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
grafana/traces-drilldown#980 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openremote/openremote#3487 · 1 comment ·
-
triage:needs-human
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
garrytan/gbrain#7635 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
coollabsio/jean#867 ·
Maintainers usually reply within 1 day