Repository navigation
fix: count { success: false } results as failures in the effect tracker (GIT-104) - #32
Merged
1 commit merged intoSep 21, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
…er (GIT-104)
track() recorded any resolved promise as a success. Several tracked writers
catch their own errors and resolve anyway, so `health` reported failed writes
as succeeded. On a blank Supabase, scar_usage 404s and knowledge_triples 400s
were both counted as successes.
- track(): a resolved value of the form { success: false } is recorded as a
failure (message from error, then message, then display). The value is still
returned to the caller. Rejections are unchanged.
- Tracked writers that swallowed errors now let the tracker see them:
- writeTriples attempts every triple, then rejects with a summary if any
failed.
- generateVariantsForScar rejects if a variant insert failed.
- Cache writes under track() use a rejecting writeResult(). setResult()
keeps swallowing for its direct callers.
- The session_close transcript task returns the save result.
- recordScarUsageBatch reports the error text on failure.
Tests: +11 (6 effect-tracker outcome accounting, 5 tracked-writer failure
surfacing).
Co-Authored-By: Claude Opus 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.
Linear: https://linear.app/nteg-labs/issue/GIT-104
What
Makes
healthreport failed writes as failures. Before this change,EffectTracker.track()counted any resolved promise as a success. Tracked writers that catch their own errors and resolve anyway were therefore reported as successes.track(): a resolved value of the form{ success: false }is now recorded as a failure. The message comes fromerror, thenmessage, thendisplay. The value is still returned to the caller, and rejections are handled as before.writeTriplesattempts every triple, then rejects with a summary if any failed.generateVariantsForScarrejects if a variant insert failed. It usedPromise.allSettledand always resolved.track()use a new rejectingwriteResult().setResult()keeps swallowing for its direct callers (check, tests).session_closetranscript task now returns its save result, so{ success: false }is visible.recordScarUsageBatchnow puts the error text on its{ success: false }result.track()call-site audit (18 sites)tools/session-close.ts:1484scar_usage/session_close_batch{success:false}(record-scar-usage-batch.ts:201-209){success:false}tools/create-thread.ts:347triple_write/thread_creationwriteTriples)tools/resolve-thread.ts:236triple_write/thread_resolutiontools/resolve-thread.ts:249triple_write/thread_resolution_cascadetools/create-decision.ts:95triple_write/decisiontools/create-learning.ts:242triple_write/learningtools/create-learning.ts:258variant_generation/learningPromise.allSettled, logs only)services/cache.ts:226cache_set/scar_searchsetResulttry/catch)writeResult) → failureservices/cache.ts:252cache_set/decisionsservices/cache.ts:278cache_set/winsservices/cache.ts:316cache_set/sessionsservices/cache.ts:339cache_set/scar_usagetools/session-close.ts:1369transcript/session_close{success:false}save result was dropped; the fn returnedundefined)tools/session-close.ts:1435embedding/session_closeembedthrows on API errors,directPatchthrows)tools/contribute-feedback.ts:118feedback/remote-submitsubmitFeedbackRemotethrows on non-2xx)services/metrics.ts:168metrics/<tool>directUpsert)services/metrics.ts:363relevance_update/<session>listRecords/directUpsert)(
lib/telemetry.tshas its own unrelatedtrack()method; it isn't the effect tracker.)Venue check: blank Supabase (
setup.sqlonly, no edge functions)Driver:
tests/e2e/blank-supabase.mjs(draft PR,test/GIT-83-blank-supabase-driver), flow mode.Before (main
d47a625): the netlog showsPOST /rest/v1/scar_usage → 404andPOST /rest/v1/knowledge_triples → 400, buthealthreports them as succeeded:After (this branch): the same two requests are now reported:
The
metrics409 is the intermittent GIT-73 race. It didn't hit this run.Expect
healthto show more failures after this merges. It isn't a regression: the failures already happened and are now counted. Those failures are fixed by GIT-84 (scar_usage), GIT-105 (triples) and GIT-106 (variants).Tests
npx tsc --noEmit -p .: no errorsnpm run test:unit(withHOMEset to a temp dir): 76 files / 1224 tests passed. main is 74 / 1213, so this adds +11 tests in 2 files:{success:false}counts as a failure,{success:true}and plain values count as successes, a rejection counts as a failure, plus message preference and the summary.writeTriplesandgenerateVariantsForScarreject on a partial failure, and the tracker counts it.Unit-test note:
beforeEach(() => mock.mockReset())combined with this repo'sclearMocks/restoreMocksconfig made vitest 1.6 fail a passing test with the mock's error. The config already resets mocks between tests, so the new tests don't usebeforeEach.No version bump and no publish.
🤖 Generated with Claude Code