Skip to content

feat(decopilot): split web research into web_search + deep_research - #4134

Merged
viktormarinho merged 3 commits into
mainfrom
cecilia-marques/split-web-deep-research
Jun 25, 2026
Merged

viktormarinho merged 3 commits into
mainfrom
cecilia-marques/split-web-deep-research

Conversation

@cecilia-marques

@cecilia-marques cecilia-marques commented Jun 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Splits the single Web research model tier / tool / chat mode into two distinct ones so the user (and the agent) can choose intent explicitly:

  • Web search — quick, streaming search (e.g. Perplexity Sonar)
  • Deep research — slow, multi-source async research (e.g. Gemini Deep Research, perplexity/deep-research)

Why

Today there's one web_research slot and one web_search tool; behavior is decided entirely by which model is configured. If a deep-research model is the configured default, every web search — agent-initiated or the chat toggle — kicks off the slow async job, even for trivial questions. This separates the two so a quick lookup stays quick.

What changed

Model tiers / config — web_research → web_search (quick) + deep_research (deep), threaded through schema, storage, SDK defaults, resolveTier, ModelsConfig (models.webSearch + models.deepResearch), per-slot providers, normalize/permissions/dispatch, automations, and background reaction turns.

Tools — web_search (mode "quick", always streaming) + new deep_research (mode "deep", async when supported), both via the shared createClusterResearchJob factory. Forcing streaming on the quick tool means a misconfigured deep/async model can't turn a quick lookup into a slow job.

Chat modes — added deep-research alongside web-search across the wire schema, persisted run-config, mode-config (tool forcing + instruction prompt), Tools popover (🔭 Deep research item), and composer pills.

Settings UI — one "Web research" row → two rows (Web search / Deep research) with capability-aware model filters (quick row hides async-only deep models; deep row favors them).

Migration 118 — capability-aware split of the existing org web_research tier: deep/async model ids → deep_research, everything else → web_search, leaving the other slot to fall back to a curated default (rather than blindly copying into both, which would re-create the slow-search bug for orgs on a deep model).

Testing notes

  • bun run check ✅ · bun run lint ✅ (0 errors) · unit tests ✅
  • Migration 118 applies cleanly on the dev DB.
  • Verified locally: settings shows two rows; chat popover shows Web search + Deep research with independent pills; both tools register and the agent self-selects via tool descriptions.

One follow-up: the deep_research tool currently reuses the existing data-web-search streaming UI, so its progress card renders identically to web search. Can add a distinct "Deep research" card if desired.

🤖 Generated with Claude Code


Summary by cubic

Split “Web research” into two paths: web_search (quick, streaming) and deep_research (slow, multi‑source). Users and agents can pick the right intent, and quick lookups no longer trigger slow deep research.

  • New Features

    • Replaced the web_research tier with web_search and deep_research across schema, storage, ModelsConfig, resolveTier, permissions, dispatch, automations, and background reactions.
    • Added two tools: web_search (forces streaming) and deep_research (uses async when supported). Each resolves its own provider (webSearchProvider, deepResearchProvider) and shares the createClusterResearchJob factory.
    • Added a deep-research chat mode. Both web-search and deep-research modes are one-shot. Updated wire/run-config schemas and the instruction prompt to guide tool choice.
    • UI: Settings now has separate “Web search” and “Deep research” rows with capability-aware filters. Chat Tools popover and composer show both options, with per-mode model selection.
    • SDK/defaults: introduced WEB_SEARCH_MODEL_PREFERENCES and DEEP_RESEARCH_MODEL_PREFERENCES; added isQuickSearchModel(Id) and isDeepResearchModel(Id) in @decocms/mesh-sdk and used them in settings, chat pickers, and the default picker. Quick search also recognizes OpenAI *-search-preview and OpenRouter :online, and excludes async‑only deep models.
  • Migration

    • Migration 122 splits existing org web_research into web_search vs deep_research based on model id containing “deepresearch” (punctuation/case‑insensitive).
    • Routes “deepresearch” ids to deep_research; everything else (e.g. Sonar) to web_search. Leaves the other slot empty to fall back to curated defaults, avoiding slow-search regressions.
    • Idempotent; not reversible.

Written for commit 205d330. Summary will update on new commits.

Review in cubic

cecilia-marques and others added 3 commits June 24, 2026 16:27
Separate the single "Web research" model tier/tool/mode into two:
- `web_search` — quick, streaming search (e.g. Perplexity Sonar)
- `deep_research` — slow, multi-source async research (e.g. Gemini Deep
  Research, perplexity/deep-research)

Both tools are registered when configured, so the agent picks the right
one per task; the chat Tools popover exposes each as its own mode/pill.
The quick `web_search` tool forces the streaming path so a misconfigured
deep/async model can never turn a quick lookup into a slow research job.

Settings now shows two rows (Web search / Deep research) with
capability-aware model filters. Migration 118 splits the existing
`web_research` org tier by model id — deep/async models route to
`deep_research`, everything else to `web_search` — leaving the other slot
to fall back to a curated default rather than blindly copying into both.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… classifier

Address review feedback on the web_search/deep_research split:

- Add unit tests for migration 118's tier classification and the
  load-bearing "quick mode never launches an async job" path-selection
  guarantee in createClusterResearchJob.
- Centralize the quick-vs-deep model classifier in @decocms/mesh-sdk
  (isQuickSearchModel / isDeepResearchModel) and consume it from chat,
  settings, and the default-picker — was duplicated across three sites.
  Broaden quick search beyond Perplexity Sonar to also recognize OpenAI
  *-search-preview and OpenRouter :online models; asyncResearch is now
  the load-bearing exclusion, name-matching only secondary.
- Clarify in comments that mode "quick" is a backstop against launching
  an async research job, not a latency guarantee — the capability-aware
  UI filter is the primary guard keeping slow models out of the slot.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Conflict: apps/mesh/migrations/index.ts — main shipped migrations 118-121,
colliding with this branch's 118-split-web-research-tier. Renumbered the
unmerged migration 118 -> 122 (next free slot) and updated its file names,
self-reference, test import, and the 077 back-reference comment. SimpleModeTier
in storage/types.ts auto-merged cleanly (web_research -> web_search/deep_research).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@viktormarinho
viktormarinho merged commit c35055d into main Jun 25, 2026
14 of 16 checks passed
@viktormarinho
viktormarinho deleted the cecilia-marques/split-web-deep-research branch June 25, 2026 17:08
viktormarinho added a commit that referenced this pull request Jun 25, 2026
#4134 split the `web_research` simple-mode tier into `web_search` +
`deep_research`, and SimpleModeConfigSchema requires all six tier keys to
be present. The multi-pod cluster seeder still sent the pre-split shape
(`web_research: null`, no `web_search`/`deep_research`), so
ORGANIZATION_SETTINGS_UPDATE rejected the payload, the org's "smart" tier
was never persisted, and every cluster chat/automation fell back and
failed with `TierUnavailableError: No model available for tier "smart"`.

That broke 3 multi-pod scenarios on main: cross-pod `/attach` and the two
automation-webhook tests. Send the post-#4134 tier shape so the smart
tier persists.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
viktormarinho added a commit that referenced this pull request Jun 25, 2026
…tup (#4150)

#4134 split the `web_research` simple-mode tier into `web_search` +
`deep_research`, and SimpleModeConfigSchema requires all six tier keys to
be present. The multi-pod cluster seeder still sent the pre-split shape
(`web_research: null`, no `web_search`/`deep_research`), so
ORGANIZATION_SETTINGS_UPDATE rejected the payload, the org's "smart" tier
was never persisted, and every cluster chat/automation fell back and
failed with `TierUnavailableError: No model available for tier "smart"`.

That broke 3 multi-pod scenarios on main: cross-pod `/attach` and the two
automation-webhook tests. Send the post-#4134 tier shape so the smart
tier persists.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
tlgimenes added a commit that referenced this pull request Jun 25, 2026
main's #4134 (split web_research into web_search + deep_research) changed
two registered-workflow files — automations/dbos-workflow.ts and
harnesses/decopilot/background-tool-workflow.ts — entirely inside existing
step bodies (no DBOS.runStep added or reordered). Recovery-compatible, so
no DBOS_WORKFLOW_VERSION bump; just re-baseline the source-hash snapshot.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
tlgimenes added a commit that referenced this pull request Jun 25, 2026
…ed stranding (#4143)

* feat(dbos): add manually-maintained DBOS_WORKFLOW_VERSION constant

* feat(dbos): inject pinned applicationVersion via buildDbosConfig

* docs(dbos): tripwire comments linking workflows to DBOS_WORKFLOW_VERSION

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* feat(dbos): source-hash guard forcing a version decision on workflow changes

* docs(dbos): note DBOS Cloud bypass + qualify guard's marker-form coverage

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* feat(dbos): log the pinned application version on boot for verifiability

* fix(dbos): drop unused exports flagged by knip (guard internals stay module-private)

* chore(dbos): re-baseline workflow-source snapshot after main merge

main's #4134 (split web_research into web_search + deep_research) changed
two registered-workflow files — automations/dbos-workflow.ts and
harnesses/decopilot/background-tool-workflow.ts — entirely inside existing
step bodies (no DBOS.runStep added or reordered). Recovery-compatible, so
no DBOS_WORKFLOW_VERSION bump; just re-baseline the source-hash snapshot.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
tlgimenes pushed a commit that referenced this pull request Jul 16, 2026
…TS.md (#4475)

Mined ~300 merged PRs for the delta between the first PR proposal and the
work added before merge. The dominant shape: a first draft ships the happy
path, then a hardening pass (often a different engineer who takes over the
branch and merges — the vibecoder→engineer handoff) adds the same categories
every time. Encoded those 9 categories as an actionable first-pass checklist,
each citing a real PR (#4008, #4230, #4365, #4409, #4426, #4445, #4357, #4355,
#4449, #4350, #4373, #4416, #4446, #4461, #4134, #4469).

Covers: variant/edge-case handling, tenant/permission scoping, concurrency &
silent-data-loss, test-per-fix + invert-bug-tests + real-PG, dead-code/knip,
lifecycle symmetry + state reset, kill-switch/GC/git-exclude for risky infra,
input validation vs over-engineering, compile-time type-safety.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants