Feat/tfa rca mcp bridge#339
Merged
ruturaj-browserstack merged 13 commits intoJul 14, 2026
Merged
Conversation
Pure, dependency-free parser for TFA reply_markdown: reads the additive
<!-- tfa-status: {...} --> marker when present, infers RESOLVED from a
## Final RCA heading otherwise, normalizes confidence (string + numeric),
extracts tasks/questions, and never throws on malformed input.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stateless submit+poll against the o11y rcaChat proxy. Hardcoded o11y base const (no env, no localhost), apiClient (not fetch), manual Basic auth header, raise_error:false on the poll, progress notifications, and clean group-scope- safe error mapping (consent/IDOR/expired/failed) plus a soft-PENDING handoff on wall-clock cap. Zod param shapes live in constants.ts; no credential fields. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Single team-agnostic submit+poll-in-one MCP tool wired behind a minimal Zod schema and the real inline trackMCP (4-arg) + try/catch + handleMCPError pattern (no nonexistent withInstrumentation middleware). Domain failures return a specific isError envelope and still fire exactly one trackMCP. Registered in the server-factory toolAdders array. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The tfaRcaTurn tool now reads the LLM-enforced TurnResponse (status/confidence/asks/questions/suggestions/hypotheses/rca/blocked) directly from the o11y rcaChat poll body instead of inferring status from free markdown + the <!-- tfa-status --> HTML-comment marker. - delete src/tools/tfa-rca-utils/status-parser.ts + its test - types.ts mirrors the misc-services TurnResponse (TfaAsk/EvidenceType/TfaRca) - submit-turn.ts maps the nested structured turn (snake_case -> camelCase), drops replyMarkdown/tasks/marker handling - tfa-rca-collaboration.ts returns the structured fields; PENDING still carries turnId for resume - tests assert structured reads (typed asks routable by evidenceType, RESOLVED rca, BLOCKED reason/unmetAsks, status-without-inference); inference/marker assertions removed Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolve the rcaChat o11y base URL from the process-startup config singleton (src/config.ts O11Y_TFA_RCA_BASE_URL, env-derived and frozen) instead of a hardcoded constant, so the tool can target the o11y env where a build's representatives live. Default stays the rengg-tfa endpoint, so existing callers are unchanged. Not a process.env read in tool code and not a Zod tool input field, per tool-design + multi-tenant-safety + security rules. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Surface per-test failure detail (category, capped error summary, file path, flaky flags) behind a new includeFailureDetail flag (default false → byte-identical existing payload). Reads sibling fields already returned by the test-runs API and discarded today; never returns full stack traces. Seeds downstream failure-signature clustering without per-test probe turns. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ature Closes the coverage gap flagged in review: error_summary extraction from an object entry using the .text fallback (alongside the existing .message case). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ging)
getTestIds hardcoded api-automation.browserstack.com, so it could not list a
build that lives in a non-prod env (e.g. rengg-tfa). Add a
BROWSERSTACK_AUTOMATION_BASE_URL startup-config knob (default prod), mirroring
the O11Y_TFA_RCA_BASE_URL pattern, surfaced via getAutomationBaseUrl(); listTestIds
now builds its /ext/v1/builds/{id}/testRuns URL from it. Set the env var to a
rengg/staging host to point the tool there — no code change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… list extractFailedTestIds gated on 'status===status && run_count', but JUnit-uploaded builds report run_count=0 even for genuinely failed tests, so listTestIds returned zero rows for them (the build looked empty though the API clearly had failures). The observability_url 'details=<id>' check already filters to real test nodes (suite/hook nodes carry no status/url), so the run_count guard was redundant and harmful. Drop it. Verified against a real rengg-tfa upload: 0 -> 7 failed rows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l output
triggerRcaReport POSTs the o11y external Release Readiness trigger
(/ext/v1/ai/builds/{buildUuid}/releaseReadiness/trigger?force=<bool>)
with Basic auth and returns a trimmed glimpse only ({state, verdict,
verdictProvisional, partial, analyzedCount, totalFailedCount, totalPrs,
faultyPrNumbers, failureReason, viewReport}) — never the raw response
or the prs[]/workflows[] arrays. 403 plan/flag fences and
REPO_NOT_CONFIGURED / RELEASE_READINESS_NOT_FOUND map to clear isError
texts. viewReport links the TRA UI via new startup config
BROWSERSTACK_O11Y_UI_BASE_URL (default observability.browserstack.com);
the /builds/{buildUuid} path shape is flagged as an assumption behind a
single constant.
tfaRcaTurn terminal turns are now trimmed in submit-turn: RESOLVED
returns {status, confidence, threadId, glimpse{root_cause <=220 chars,
failure_type, related_prs}, viewRca} and drops the full rca payload;
NEEDS_INFO keeps questions/asks/suggestions/hypotheses verbatim for the
client loop; PENDING keeps {status, turnId, threadId}. The full RCA
lives on the Test Observability dashboard — the tool surfaces a glimpse
and redirects humans there.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
viewReport/viewRca now point at the real AI-TFA report location: https://automation.browserstack.com/builds/{buildUuid}?tab=ai_report&subTab=aitfa (designer-confirmed 2026-07-13; replaces the flagged observability.browserstack.com /builds/{buildUuid} assumption). {buildUuid} is substituted from the caller-given build id. Default BROWSERSTACK_O11Y_UI_BASE_URL updated; tests pinned to the new shape. npm run build green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…idge # Conflicts: # src/tools/rca-agent-utils/get-failed-test-id.ts
api-automation.browserstack.com — live-verified to route the /ext/v1 testRca + rcaChat endpoints (probe returned the persisted E2E RCA). Staging tenants (api-observability-<tenant>.bsstag.com) become the override case. Build gate green (265 tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.