Commit cbbbb5c
authored
fix(coding-agents): name the calling harness in every MCP registration (#3612)
* fix(coding-agents): name the calling harness in every MCP registration
Claude Code and Codex launch the same dist/mcp-server.js, and only
HINDSIGHT_MCP_HARNESS tells that server which one is calling. Four
installers never set it — codex, cursor-cli, copilot-cli and grok-build —
so their sessions fell back to "claude-code" for both the retain stamp
and bank derivation: a Codex hindsight_ingest_document landed tagged
harness:claude-code, indistinguishable from Claude Code's own writes.
Every registration now names its own harness (claude-code included, so it
no longer depends on the fallback). Codex's install also REPLACES an
existing [mcp_servers.hindsight] block instead of skipping when one is
present — appending only when absent made it install-once-only, so the
harness-less block could never be repaired by re-running the installer,
which is the upgrade path for anyone already hitting this.
The guard sweeps INSTALLERS and greps whatever the install actually wrote
for mcp-server.js: the harness that forgets is by construction the one
nobody wrote a test for.
Fixes #3603
* fix(coding-agents): require HINDSIGHT_MCP_HARNESS instead of guessing claude-code
The fallback read as a safe convenience and was not. Every host launches
the same mcp-server.js, so a registration that named no harness was
silently served as Claude Code — which is what made #3603 invisible: the
mis-stamped documents looked exactly like Claude Code's own. A wrong
harness corrupts stored data (the harness:<id> stamp and the bank the
session resolves); refusing to start is recoverable by re-running the
installer, and the error says so.
That turned up a second registration site the installer sweep could not
see: the codebase survey builds INLINE MCP recipes for its claude-code
and codex spawns (core/survey.ts), and neither named a harness — so a
Codex-run survey already filed its findings as harness:claude-code in
Claude Code's bank, and would now fail to start at all. Both recipes name
their agent.
Guarded by a source sweep modelled on the daemon-parity test: a module
that points at mcp-server.js is registering it and must assign the
variable. It matches an assignment rather than a mention on purpose — a
bare-name search is satisfied by the comments this fix added next to each
registration, which is exactly how survey.ts would have slipped through
again.1 parent 7ebf23d commit cbbbb5c
6 files changed
Lines changed: 241 additions & 41 deletions
File tree
- hindsight-integrations/coding-agents/src
- core
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
79 | 82 | | |
80 | 83 | | |
81 | 84 | | |
| |||
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
209 | 213 | | |
210 | 214 | | |
211 | 215 | | |
| |||
250 | 254 | | |
251 | 255 | | |
252 | 256 | | |
| 257 | + | |
| 258 | + | |
253 | 259 | | |
254 | 260 | | |
255 | 261 | | |
| |||
Lines changed: 76 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
3 | 11 | | |
4 | 12 | | |
5 | 13 | | |
| |||
119 | 127 | | |
120 | 128 | | |
121 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
122 | 134 | | |
123 | 135 | | |
124 | 136 | | |
| |||
179 | 191 | | |
180 | 192 | | |
181 | 193 | | |
| 194 | + | |
182 | 195 | | |
183 | 196 | | |
184 | 197 | | |
| |||
205 | 218 | | |
206 | 219 | | |
207 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
208 | 240 | | |
209 | 241 | | |
210 | 242 | | |
| |||
543 | 575 | | |
544 | 576 | | |
545 | 577 | | |
| 578 | + | |
546 | 579 | | |
547 | 580 | | |
548 | 581 | | |
| |||
585 | 618 | | |
586 | 619 | | |
587 | 620 | | |
| 621 | + | |
588 | 622 | | |
589 | 623 | | |
590 | 624 | | |
| |||
683 | 717 | | |
684 | 718 | | |
685 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
686 | 761 | | |
687 | 762 | | |
688 | 763 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
147 | 162 | | |
148 | 163 | | |
149 | 164 | | |
| |||
369 | 384 | | |
370 | 385 | | |
371 | 386 | | |
| 387 | + | |
| 388 | + | |
372 | 389 | | |
373 | 390 | | |
374 | 391 | | |
| |||
378 | 395 | | |
379 | 396 | | |
380 | 397 | | |
381 | | - | |
| 398 | + | |
382 | 399 | | |
383 | 400 | | |
384 | 401 | | |
| |||
408 | 425 | | |
409 | 426 | | |
410 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
411 | 439 | | |
412 | 440 | | |
413 | 441 | | |
| |||
419 | 447 | | |
420 | 448 | | |
421 | 449 | | |
422 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
423 | 454 | | |
424 | | - | |
| 455 | + | |
| 456 | + | |
425 | 457 | | |
426 | 458 | | |
427 | 459 | | |
| |||
434 | 466 | | |
435 | 467 | | |
436 | 468 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
443 | 472 | | |
444 | 473 | | |
445 | 474 | | |
446 | 475 | | |
447 | | - | |
448 | | - | |
| 476 | + | |
| 477 | + | |
449 | 478 | | |
450 | 479 | | |
451 | 480 | | |
| |||
462 | 491 | | |
463 | 492 | | |
464 | 493 | | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
| 494 | + | |
469 | 495 | | |
470 | 496 | | |
471 | 497 | | |
| |||
505 | 531 | | |
506 | 532 | | |
507 | 533 | | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 534 | + | |
513 | 535 | | |
514 | 536 | | |
515 | 537 | | |
| |||
915 | 937 | | |
916 | 938 | | |
917 | 939 | | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
| 940 | + | |
923 | 941 | | |
924 | 942 | | |
925 | 943 | | |
| |||
959 | 977 | | |
960 | 978 | | |
961 | 979 | | |
962 | | - | |
| 980 | + | |
963 | 981 | | |
964 | 982 | | |
965 | 983 | | |
| |||
1001 | 1019 | | |
1002 | 1020 | | |
1003 | 1021 | | |
1004 | | - | |
| 1022 | + | |
1005 | 1023 | | |
1006 | 1024 | | |
1007 | 1025 | | |
| |||
1048 | 1066 | | |
1049 | 1067 | | |
1050 | 1068 | | |
1051 | | - | |
| 1069 | + | |
| 1070 | + | |
1052 | 1071 | | |
1053 | 1072 | | |
1054 | 1073 | | |
| |||
1099 | 1118 | | |
1100 | 1119 | | |
1101 | 1120 | | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
| 1121 | + | |
1107 | 1122 | | |
1108 | 1123 | | |
1109 | 1124 | | |
| |||
0 commit comments