Skip to content

feat(mcp): auto_profile triggers on suggest_profile for with-query fetches#91

Merged
dongwhee merged 1 commit into
developfrom
feat/auto-profile-on-suggest
Jul 6, 2026
Merged

feat(mcp): auto_profile triggers on suggest_profile for with-query fetches#91
dongwhee merged 1 commit into
developfrom
feat/auto-profile-on-suggest

Conversation

@dongwhee

@dongwhee dongwhee commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes the ignored-hint gap found in the C4 telemetry analysis: suggest_profile fired 57 times on one nvidia forum URL (visit threshold 3) with zero consumer profile_page calls — the hint works, consumers ignore it. The existing auto_profile inline generate-then-retry path only engaged on query-less missing-profile calls, so it never fired on that traffic.

Now auto_profile also fires when a with-query full-pipeline result carries suggest_profile=true and no profile was used, reusing the same inline flow. Deployment-wide enablement via TRAWL_MCP_AUTO_PROFILE=1 (per-call argument still overrides). Guardrails on the auto path only: process-lifetime failed-host cooldown + attempt cap TRAWL_MCP_AUTO_PROFILE_MAX (default 10). Default off — behavior byte-identical without env/arg, preserving the CLAUDE.md ":8080 = bounded, manual-trigger" contract.

Motivating measurement (in-container, fetch cache disabled): profiling the nvidia URL yields div.cooked, profile_direct path, total 7.9s → 4.8s (−38.9%; retrieval+rerank eliminated).

Gates

Gate Result
MCP stdio smoke PASS
New unit tests (trigger fires / stays off / failed-host cooldown / cap) 7/7
Default-off behavior unchanged
/code-review low clean

🤖 Generated with Claude Code

…tches

Telemetry (390 events, 2026-04-15~07-01) showed the suggest_profile
hint fired 57 times on one nvidia forum URL with zero consumer
profile_page calls — the hint mechanism works, consumers ignore it.
Meanwhile the existing auto_profile inline generate-then-retry path
only fired on queryless missing-profile calls, so it never engaged on
that traffic.

Changes:
- auto_profile now also fires when a with-query full-pipeline result
  carries suggest_profile=true and no profile was used, reusing the
  same inline generate-then-retry flow (refactored into
  _auto_profile_generate_and_retry).
- Env default TRAWL_MCP_AUTO_PROFILE=1 enables it deployment-wide;
  an explicit per-call auto_profile argument still overrides.
- Guardrails (auto path only; explicit profile_page unaffected):
  process-lifetime failed-host cooldown, and an attempt cap
  TRAWL_MCP_AUTO_PROFILE_MAX (default 10, surfaced as
  auto_profile_skipped: cap_reached).
- Default off: behavior byte-identical without env/arg.

Motivating measurement: profiling the nvidia URL yields div.cooked,
profile_direct path, total 7.9s -> 4.8s (-38.9%; retrieval+rerank
eliminated).

Gates: MCP stdio smoke OK; 7 new unit tests (trigger on/off,
cooldown, cap) pass; /code-review low clean.
@dongwhee dongwhee merged commit aa132ac into develop Jul 6, 2026
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.

1 participant