Repository navigation
Commit ce8b3d3
fix(core): disposition a lifetime whose last reserved extension is refused
`reserve` raises `pending` for a supplemental sequence; if that sequence then
loses admission, the former `unreserve` returned `pending` alone. When the owner
sequence had already settled successfully -- settle's `pending > 0` branch
correctly keeping the lifetime alive -- the refusal dropped `pending` to 0 with
nothing left running to call `settle` again. The lifetime sat `state: "armed"`,
`status: "running"`, `pending: 0`, permanently.
Three consequences, all reproduced before fixing:
- A blocked SYNCHRONOUS caller hangs forever: `done` is resolved only in the
disposition branch.
- The owner's completed answer is silently DISCARDED: moving the buffered
answer into the terminal Info is itself a disposition step.
- No terminal ever reaches a caller parked on `waitHandle`. The task tool parks
there to release a child session's attachment scope, so that child stays
registered and every later resume dies on the coordinator's exclusive open --
this strand could permanently recreate the bug fixed two commits ago.
Fix: the refusal settles as a sequence with NO outcome,
`settle(id, token, Exit.succeed(undefined))`. `undefined` is already a legal
SequenceOutcome, so nothing files, an already-successful owner answer still
disposes through its inline slot, and the status is `completed`. Correct rather
than convenient: the FOLLOW-UP was refused and its own caller learns so from its
own result, while the run's own work demonstrably succeeded -- marking the job
`error` would emit an error envelope for a lifetime that did not fail. No note is
attached; the caller already learns of the refusal, and a second report would be
a duplicate notice path.
`settleAdmissibility` handles the hazards for free: a replaced lifetime is
`foreign_token`, an already-terminal one `not_running`, and a concurrent second
refusal `not_running` -- each a no-op. With other sequences still registered,
settle's `pending > 0` branch keeps the lifetime alive exactly as the bare
decrement did.
`settle`'s `sequence` parameter was dead after the previous commit removed
`ledger.announced`, and `fork`'s existed only to forward it; both removed. Not
cosmetic: routing a sequence-LESS event through `settle` is correct only because
`settle` ignores `sequence`, so removing it makes that safety structural rather
than incidental.
Blast radius: the fix creates no new state -- it routes an existing path into an
already-handled state (terminal/completed) instead of an unreachable one (running
at pending 0). No caller relies on `extended: false` leaving the lifetime alive.
No reentrancy at `binder.terminal`: settle releases the registry lock before
calling it and `bind` has fully returned.
Tests: two guards, both verified to fail against the previous `unreserve`
behaviour and pass with the fix. The first pins disposition, the preserved owner
answer and the released synchronous caller in one combined assertion, so a
failing run reports every consequence at once. The second pins the `waitHandle`
waiter specifically, since that is the path the attachment-scope release depends
on. Both use bounded races rather than unbounded waits, so a regression fails
loudly instead of hanging the suite. background-job goes 22 -> 24.
Ported from the ACF fork of opencode.1 parent aeb6699 commit ce8b3d3
2 files changed
Lines changed: 164 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
594 | | - | |
| 594 | + | |
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
737 | | - | |
738 | 737 | | |
739 | 738 | | |
740 | 739 | | |
741 | 740 | | |
742 | | - | |
743 | | - | |
| 741 | + | |
| 742 | + | |
744 | 743 | | |
745 | 744 | | |
746 | 745 | | |
| |||
786 | 785 | | |
787 | 786 | | |
788 | 787 | | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | 788 | | |
803 | 789 | | |
804 | 790 | | |
| |||
963 | 949 | | |
964 | 950 | | |
965 | 951 | | |
966 | | - | |
| 952 | + | |
967 | 953 | | |
968 | 954 | | |
969 | 955 | | |
| |||
1036 | 1022 | | |
1037 | 1023 | | |
1038 | 1024 | | |
1039 | | - | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1040 | 1044 | | |
1041 | 1045 | | |
1042 | 1046 | | |
| |||
1045 | 1049 | | |
1046 | 1050 | | |
1047 | 1051 | | |
1048 | | - | |
| 1052 | + | |
1049 | 1053 | | |
1050 | 1054 | | |
1051 | 1055 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
9 | 31 | | |
10 | 32 | | |
11 | 33 | | |
| |||
421 | 443 | | |
422 | 444 | | |
423 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
424 | 563 | | |
0 commit comments