Repository navigation
Commit a719eb5
committed
fix(workspace): stop inferring user intent and ownership from MCP state
Codex round 5 on a84e7c3. Three findings, all verified; each new test was
confirmed to fail with its fix reverted.
**A removed entry is no longer mistaken for a user disable.** `MCP.remove`
deletes the runtime status, and `MCP.status()` reports any *configured* entry
with no status as `disabled`. So every rejection teardown made the following
turn look like an explicit user disable, and the session returned
`entry-disabled` for good — silently undoing the repairable-retry fix from the
previous round for its most likely path: reject an unattributable engine, fail
to replace it, install the engine, and never recover. Intent is now read from
the config's actual `enabled: false`, which is the only place a user expresses
it; the synthesized status is treated as the absence of information it is.
**An unbound project no longer tears down an entry it cannot prove it owns.**
Ownership was inferred from argv shape, but argv carries no provenance: a
hand-authored `datamate start-stdio --datamate <id>` is byte-identical to what
this feature writes, so the teardown took the user's own server offline on every
first prompt — the opposite of the guarantee its comment claimed. This module's
thesis is that you do not act on what you cannot attribute, and that has to apply
to the module itself, so it now reports and leaves the entry alone. Doing better
needs an explicit ownership marker written at persist time; that is a separate
change and is recorded in the PR body rather than guessed at here.
**The session and attach-chain maps are bounded.** They are module-level and a
long-running `serve` process creates sessions indefinitely, so they grew for the
life of the process with only a test-only reset to clear them. Sessions are now
capped with oldest-first eviction; an evicted session simply re-attaches on its
next turn, which is correct if not free. Storing this in `InstanceState` would be
the thorough fix and is noted for later.
4 further tests: a removed entry recovering through install on a later turn, a
genuinely disabled entry still respected, a pinned entry left alone in an unbound
project, and the session map staying within its cap. The round-2 test that
asserted the unbound teardown is reversed deliberately, and the round-4 disabled
test now sets `enabled: false` rather than relying on the synthesized status.1 parent a84e7c3 commit a719eb5
2 files changed
Lines changed: 115 additions & 24 deletions
File tree
- packages/opencode
- src/altimate/workspace
- test/altimate/workspace
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | 325 | | |
334 | 326 | | |
335 | 327 | | |
| |||
388 | 380 | | |
389 | 381 | | |
390 | 382 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
396 | 392 | | |
397 | 393 | | |
398 | 394 | | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
403 | 400 | | |
404 | 401 | | |
405 | 402 | | |
| |||
447 | 444 | | |
448 | 445 | | |
449 | 446 | | |
450 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
451 | 452 | | |
452 | 453 | | |
453 | 454 | | |
| |||
679 | 680 | | |
680 | 681 | | |
681 | 682 | | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
682 | 691 | | |
683 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
684 | 710 | | |
685 | 711 | | |
686 | 712 | | |
| |||
737 | 763 | | |
738 | 764 | | |
739 | 765 | | |
740 | | - | |
| 766 | + | |
741 | 767 | | |
742 | 768 | | |
743 | 769 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | | - | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
644 | 646 | | |
645 | 647 | | |
646 | 648 | | |
647 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
648 | 652 | | |
649 | 653 | | |
650 | 654 | | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
654 | | - | |
| 658 | + | |
655 | 659 | | |
656 | 660 | | |
657 | 661 | | |
| |||
807 | 811 | | |
808 | 812 | | |
809 | 813 | | |
810 | | - | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
811 | 817 | | |
812 | 818 | | |
813 | 819 | | |
| |||
853 | 859 | | |
854 | 860 | | |
855 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
0 commit comments