Commit e984494
committed
✨ feat(api,graph,console,core): search runs surface the work — coordinator trace lane, agent-emitted result cards, honest run stats; async workspace indexing; external session cwd (#100)
Root-caused from live run `run-02ad562781` (`/search?run=run-02ad562781&ws=ws-00f72e0c`): a fast-tier orchestrated run completed with an accurate synthesis but a blank instrument panel — `trace: []`, `results: []`, `confidence 0.0`, `sources_count 0`, `total_ms 0` (real elapsed ~170s, 33 tool calls). Mongo + Langfuse confirmed the root `scg-search` agent inlined ALL the work and never spawned a probe, and the entire event-log projection keyed off `sub_agent` events alone. This PR makes the run surface honest end-to-end and folds in the three companion regressions found during the same sweep. All wire changes are additive (no `OUTPUT_CONTRACT_VERSION` bump).
## New features
- **Coordinator trace lane** (#95-A): root-agent tool activity projects onto the run event log live (`RunEventStreamer`) and at settle through ONE shared `CoordinatorTrace` projection — zero-probe runs render a real trace. Lines are digests only (tool id + capped input hint, `ok|error`); the tool's result payload is never read (connector returns can carry secrets).
- **Agent-emitted result cards** (#95-B): new `scg_results` SessionTool in `mewbo_graph.plugins.scg` — transcript-as-transport: the tool only validates (≤50 entries, `extra="forbid"`, relevance/confidence 0..1) and the api projects entries → `result` events + `RunPayload.results` (stable `r-<run8>-<n>` ids = live↔settle dedup key). The `scg-search` playbook now emits the cards before the final synthesis (root-only).
- **Honest settle metrics** (#95-C): `total_ms` computed `started_at→settle` on `run_done`, the payload, and the fail path; `confidence`/`sources_count` cover root-inline runs (data-bearing probe lanes ∪ emitted results' distinct sources) with documented provenance; unknown still suppresses, never fabricates.
- **Results-page top band rebuilt** (#96): the query lives ONLY in the composer (the duplicated italic-mono echo is gone); `RunStats` joins only earned parts — a finished run never shows `0.0s` or `0 results` (snapshot elapsed falls back `total_ms` → `created_at→completed_at`); Copy-link + Configure sit in a calm right-aligned meta row; coordinator lanes render a `Workflow` glyph across ProgressStrip/RightRail/TraceDrawer, never a blank avatar or a misleading `0` chip.
- **External session cwd** (#91): `POST /api/sessions` + `/query` accept an optional `cwd` behind `api.allow_external_cwd` (default OFF) via one `ExternalCwdPolicy` seam — explicit cwd wins over project resolution, persists in session context, and is honored on `/message` re-engagement and the diff endpoints. Lets external workspace managers (Grove) anchor sessions in their own worktrees without provided-path v_projects (which the reaper deletes).
## Stability
- **Workspace create/edit is register-and-return** (#97, serious UX regression): the auto-map fan-out (live MCP descriptor builds + drift checks) ran in the Flask request thread — "Create Workspace" blocked for N MCP handshakes and read as browser-dependent indexing. Step 1 (virtual-config refresh) stays sync; everything else runs on a named daemon worker. `join_last_fan_out` gives route tests deterministic settling. Map jobs were already durable/background.
- **Recents dedupe + unique cmdk identity** (#98-A): duplicate past queries no longer hover/select together — `CommandItem value` was the bare query text (cmdk identity collision); now `pastQueryKey` (run_id) + `dedupePastQueries` (normalized text, most-recent wins) shared by SearchBar + LandingPanel.
- **Workspace card polish** (#98-B): single-line meta shelf by contract (`mt-auto flex-nowrap`, `flex-none` action cluster + "N past" pill, `min-w-0 overflow-hidden` avatar rail), footer pinned so rows in the grid read consistently.
## Docs
- CLAUDE.md refresh across `agentic_search` (api + scg + console), the scg plugin suite, and `apps/mewbo_api`: coordinator-lane/`scg_results`/metrics decisions, the open `resolve_entity`-in-search gap (#95-D — gating entity tools on wiki-ctx presence is the future fix, not a manifest hack), RunStats honesty rules, the cmdk value-collision trap, the async fan-out invariant, and the #91 endpoint contract.
## Validation
- Python: ruff clean, mypy clean (230 files), **4373 passed / 3 skipped** (includes 13 new `scg_results` tests, 12 new `external_cwd` tests, 2 new async fan-out tests, reenrich suite adapted to the async seam).
- Console: vitest **342 passed / 4 skipped** (full suite; +14 new across ResultsPanel/SearchBar/LandingPanel), `tsc --noEmit` clean, eslint clean.
- Caveat: validated locally + by test suites; not yet re-verified against the deployed stack (api/graph are bind-mounted — `docker compose up -d`; console needs `npm run build` + restart).
Closes #95. Closes #96. Closes #97. Closes #98. Closes #91.
Reviewed-on: https://git.hurricane.home/bearlike/Assistant/pulls/1001 parent c786f5f commit e984494
29 files changed
Lines changed: 2751 additions & 225 deletions
File tree
- apps
- mewbo_api
- src/mewbo_api
- agentic_search
- scg
- tests
- mewbo_console/src/components/agentic_search
- packages
- mewbo_core/src/mewbo_core
- mewbo_graph/src/mewbo_graph/plugins/scg
- .claude-plugin
- agents
- tests/agentic_search
- scg
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
18 | 28 | | |
19 | 29 | | |
20 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
137 | 142 | | |
138 | 143 | | |
139 | 144 | | |
| |||
203 | 208 | | |
204 | 209 | | |
205 | 210 | | |
206 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
207 | 220 | | |
208 | 221 | | |
209 | 222 | | |
| |||
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
91 | 138 | | |
92 | 139 | | |
93 | 140 | | |
| |||
Lines changed: 182 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
| |||
299 | 306 | | |
300 | 307 | | |
301 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
302 | 325 | | |
303 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
304 | 332 | | |
305 | 333 | | |
306 | 334 | | |
| |||
323 | 351 | | |
324 | 352 | | |
325 | 353 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
| 354 | + | |
| 355 | + | |
332 | 356 | | |
333 | 357 | | |
334 | 358 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
339 | 364 | | |
340 | 365 | | |
341 | 366 | | |
| |||
355 | 380 | | |
356 | 381 | | |
357 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
358 | 386 | | |
359 | | - | |
| 387 | + | |
360 | 388 | | |
361 | 389 | | |
362 | 390 | | |
| |||
366 | 394 | | |
367 | 395 | | |
368 | 396 | | |
369 | | - | |
| 397 | + | |
370 | 398 | | |
371 | 399 | | |
372 | 400 | | |
| |||
460 | 488 | | |
461 | 489 | | |
462 | 490 | | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
473 | 504 | | |
474 | | - | |
| 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 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
475 | 631 | | |
476 | | - | |
477 | | - | |
| 632 | + | |
478 | 633 | | |
479 | 634 | | |
480 | 635 | | |
| |||
519 | 674 | | |
520 | 675 | | |
521 | 676 | | |
| 677 | + | |
522 | 678 | | |
523 | 679 | | |
524 | 680 | | |
| |||
0 commit comments