Repository navigation
Commit fee2a0c
committed
fix(workspace): announce late attachments, re-attribute cached successes, close the stale-config class
Codex round 10. Three findings, all verified; each fix confirmed to fail only its
own test when reverted. The config-cache class fix is folded in as agreed.
**A late attachment now announces itself.** MCP.add stores the client but
publishes nothing, so an attach landing after the turn's bounded wait — or on a
repair retry, which never waits — produced tools the session had no way to learn
about until the user sent another message. This branch has been documenting a
tools-changed fallback as the justification for the wait being safe; that
fallback depended on an event nobody published. It is published now.
**A cached success is re-attributed, not merely re-connected.** Link A to B and
back to A, with another session attaching B in between, and this session's key
matches its original memo while the instance-wide client is serving B. The
round-8 re-probe only checked that something was connected, so every later turn
would expose B's tools under binding A. The live entry's pin is now checked too,
which is what makes it ours.
**The optional catalog lookup can no longer block a local spawn.** declared() is
reporting only, but it runs before the engine is launched and its HTTP layer has
no abort timeout, so an API that accepts a connection and then stalls stopped a
good cached binding and an installed engine from ever attaching — and later turns
kept returning the same pending task, since a pending attach has no settled
repairable outcome. It is bounded now; reporting degrades, attaching does not
wait on it.
**Config reads are fresh by construction.** Three separate bugs in this module
came from reading a per-instance cache after someone else wrote: our own
addMcpToConfig, MCP.disconnect writing enabled:false, and an IDE rewriting the
entry — which never goes through Config at all. Two of them defeated a fix from
an earlier round. The writers cannot be enumerated, so freshness belongs at the
point of read: freshConfig() is now the module's only path to config, and the
single reader goes through it, which makes all three call sites correct without
touching them. The ad-hoc invalidation added last round is removed rather than
left as a second answer to the same question.
The cost is named rather than hidden: invalidating drops the shared per-instance
cache, so other Config consumers re-read.
Also fixed in the test harness: the mocked config now reflects an entry after it
is persisted, as production does. Without that the pin re-check saw no entry and
a legitimate memo looked like a workspace change.1 parent d6f5b5b commit fee2a0c
2 files changed
Lines changed: 164 additions & 25 deletions
File tree
- packages/opencode
- src/altimate/workspace
- test/altimate/workspace
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
135 | | - | |
| 138 | + | |
| 139 | + | |
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
| |||
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
293 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
294 | 304 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
300 | 311 | | |
301 | 312 | | |
302 | 313 | | |
| 314 | + | |
303 | 315 | | |
304 | 316 | | |
305 | 317 | | |
306 | 318 | | |
307 | 319 | | |
308 | | - | |
| 320 | + | |
309 | 321 | | |
310 | 322 | | |
311 | 323 | | |
| |||
378 | 390 | | |
379 | 391 | | |
380 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
381 | 411 | | |
382 | 412 | | |
383 | 413 | | |
| |||
524 | 554 | | |
525 | 555 | | |
526 | 556 | | |
527 | | - | |
528 | | - | |
| 557 | + | |
| 558 | + | |
529 | 559 | | |
530 | 560 | | |
531 | 561 | | |
| |||
662 | 692 | | |
663 | 693 | | |
664 | 694 | | |
665 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
666 | 712 | | |
667 | 713 | | |
668 | 714 | | |
| |||
730 | 776 | | |
731 | 777 | | |
732 | 778 | | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
733 | 783 | | |
734 | 784 | | |
735 | 785 | | |
| |||
795 | 845 | | |
796 | 846 | | |
797 | 847 | | |
798 | | - | |
| 848 | + | |
799 | 849 | | |
800 | | - | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
801 | 856 | | |
802 | | - | |
| 857 | + | |
803 | 858 | | |
804 | 859 | | |
805 | 860 | | |
| |||
840 | 895 | | |
841 | 896 | | |
842 | 897 | | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
843 | 905 | | |
844 | 906 | | |
845 | 907 | | |
| |||
877 | 939 | | |
878 | 940 | | |
879 | 941 | | |
880 | | - | |
| 942 | + | |
| 943 | + | |
881 | 944 | | |
882 | 945 | | |
883 | 946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
74 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
75 | 85 | | |
76 | 86 | | |
77 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
78 | 91 | | |
79 | 92 | | |
80 | 93 | | |
| |||
1081 | 1094 | | |
1082 | 1095 | | |
1083 | 1096 | | |
1084 | | - | |
| 1097 | + | |
1085 | 1098 | | |
1086 | 1099 | | |
1087 | 1100 | | |
1088 | | - | |
1089 | | - | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1090 | 1106 | | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | 1107 | | |
1096 | 1108 | | |
1097 | | - | |
| 1109 | + | |
1098 | 1110 | | |
1099 | 1111 | | |
1100 | 1112 | | |
| |||
1113 | 1125 | | |
1114 | 1126 | | |
1115 | 1127 | | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
0 commit comments