Repository navigation
M17 slice 1: LangSmith bridge core (fetch → map → verify → feedback) - #217
Merged
Merged
Conversation
…erify → feedback) New src/core/langsmith-bridge.js + 'xflow langsmith verify' subcommand: - Official langsmith JS SDK Client; key only from env LANGSMITH_API_KEY (missing key is a hard error), optional LANGSMITH_ENDPOINT / LANGSMITH_PROJECT. - listRuns pulls root runs + full traces; each trace maps to one verification session (agent prose only — tool/retriever outputs are evidence, never claim sources). - Claims verified by the existing live-claims pipeline, unchanged semantics; score = confirmed/checked. - createFeedback (object form, synchronous) writes key evalid_claim_verified + per-claim verdict comment to the root run; write failures surface and local results are preserved. - --dry-run / --limit / --since / --cwd / --out / --json. - Fixture-driven full-chain tests with an injectable fake SDK client. Fixes #216
This was referenced Nov 18, 2026
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.
M17 slice 1: LangSmith bridge core (fetch → map → verify → feedback)
Fixes #216 · part of epic #215 (evalid as LangSmith's external deterministic judge)
What lands
src/core/langsmith-bridge.js(new) +xflow langsmith verifysubcommand:langsmithJS SDK (Client, now a package dependency). Credentials only from envLANGSMITH_API_KEY; missing key is a hard, named error — nothing is fabricated. OptionalLANGSMITH_ENDPOINT(SDKapiUrl) /LANGSMITH_PROJECT. The key is never written to disk or logs, and the SDK is dynamically imported so the rest of the CLI never loads it.listRunspulls up to--limitroot runs (newest first, optional--since), then each root's full trace. A failed child-fetch degrades that trace to its root run with the error recorded, not silently dropped.start_time;content/output/result/response, content blocks,generations[].text, serialized chat-messagekwargs.content);errors are carried as session run-errors.createClaimChecker) runs unchanged: test-run claims replay in--cwd, file claims check there; per-session dedup exactly as the live path. No existing subcommand behavior or verdict semantics touched.createFeedback({runId, sessionId, key, score, comment, feedbackSourceType: 'api'})on the trace's root run: keyevalid_claim_verified, score = confirmed/checked (4 dp), comment = per-claim verdict lines with the pipeline's evidence note + the claim's source text.traceIdis deliberately not passed so the write is synchronous — a failed write rejects here, is recorded per-trace, and the CLI keeps the local results file (to--out, or a fallbackevalid-langsmith-results.json) and exits 1. Traces with no claims get no feedback.xflow langsmith verify --project <name> [--limit 20] [--since <iso>] [--cwd <dir>] [--dry-run] [--out <file>] [--json];--dry-runfetches + verifies + reports the exact would-write payloads, writes nothing. Exit codes: 0 ok · 1 feedback write failed · 2 usage/config · 3 no runs found.Tests
test/langsmith-bridge.test.js(15 tests) + recorded-shape fixturetest/fixtures/langsmith/runs.json, SDK replaced by an injectable fake client:node --testreplays + filesystem checks in a temp workspace), score 0.5; dry-run performs zero feedback calls but records would-write payloads; write mode posts exactly one feedback with the standard key on the root run; a throwing fake surfaces the failure with verdicts intact; trace B (errored, claim-free) is skipped asno_claims; empty project is a no-op;LANGSMITH_API_KEY; no project → exit 2; barelangsmith→ help, exit 0.Local suite: new file 15/15. Full suite otherwise green except two pre-existing environment failures that reproduce identically on clean
mainin this VM (pytest-replay cases intest/i6d-acceptance-demo.test.jsandtest/xflow-audit.test.js, A/B-verified via stash) — CI is the arbiter for those.Design trade-offs
Clientnow lives under the package'slib/surface but is still exported from the root; the new Stainless-style resources client is not used.createFeedback's object form requiressessionId(or an agent address) — the bridge takes it from the root run'ssession_id; if absent, the SDK error surfaces as a recorded write failure rather than a silent skip.unknowncounts as not verified (score = confirmed/checked), matching the epic's "已核验声称占比".