Skip to content

Fix PureConc async cancelation#4624

Open
djspiewak wants to merge 6 commits into
typelevel:series/3.5.xfrom
djspiewak:bug/pureconc-async-cancelation
Open

Fix PureConc async cancelation#4624
djspiewak wants to merge 6 commits into
typelevel:series/3.5.xfrom
djspiewak:bug/pureconc-async-cancelation

Conversation

@djspiewak

Copy link
Copy Markdown
Member

Fixes #3430

I'll probably rebase this forward to 3.6 or something but I'm opening it like this as a hilarious testament to how long this took.

There are a lot of interesting things in this PR, since the root cause is just the fact that async cancelation is fundamentally different than the busy-check flatMap interruption. The most interesting bit tbh is the fact that I wasn't able to solve all of this myself. I got most of it working, but ultimately hit a wall which was essentially beyond my ability to debug about six months ago. Or rather, I probably could have worked my way through it, but it was incredibly tedious and complicated.

I've been using this branch as a testbed for the frontier agentic systems for a while now, since it's quite a novel bit of code with essentially zero precedent in kind, and as expected all of them failed spectacularly and almost immediately until my most recent effort. The commits you see from the past few days were generated by GPT 5.5 (xhigh). I would guess that Opus 4.8 and GLM 5.2 would do similarly well but haven't attempted it.

If anyone wants to play around with replicating this result, the prompt I used was the following:

We're trying to fix PureConc's cancelation implementation, which has been broken since it was written. This branch goes quite a long way to doing that, but some of the laws are still not passing. Let's fix this. Do not under any circumstances alter the laws or their harness. Also do not revise existing tests of any kind without consulting me. Adding tests is acceptable. Remember that the point of PureConc is to be a purely functional reference type, so do not "cheat" by laundering things through vars or other side effects except for debugging purposes.

This was based on a dirty working directory which had half of HEAD^ but nothing super relevant iirc (I can dig out the exact state if anyone is really interested in replication).

@mergify

mergify Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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