Repository navigation
feat: fix the coach's input (spec 004) - #13
Merged
Merged
Conversation
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.
Summary
Spec 004 fixes the input the AI coach receives. Four of the six texts of the first demo seed were rejected because of what the coach was told, not because of the analysis: it never knew which laps it compared, it was given the personal best (which in the demo is one of the compared laps), and it ranked, numbered and read the signs itself.
deltaLossS > 0, stable descending sort, first three; label<rank>. <apex>m · +<loss>s) and writes the direction of each braking, pressure and throttle difference in words.GET /sessions/:id/benchmarkis unchanged.PROMPT_VERSION(SHA-256 of the line-break-normalized prompt and of the messages built from fixed reference inputs, 16 hex) is exported and stored per row in the new columnlap_analyses.prompt_version.npm run analyzealso prints the exact message the coach would receive and the prompt version, with no paid call (the output is no longer a single JSON document).Spec, plan, research, tasks:
specs/004-coach-input/.Contract
Response shape and status codes of
POST /sessions/:id/analysisare unchanged. One behaviour change: a cached pair whose prompt version or model is not the current one (every row written before this PR hasprompt_versionNULL) is no longer served. With the API key it is regenerated (a paid call, once per pair even under concurrent requests) and the row is replaced; without the key the endpoint answers the existing503(coaching indisponível: configure ANTHROPIC_API_KEY). Current rows are still served withcached: true.The first start of this version migrates
data/telemetry.dbin place (addslap_analyses.prompt_version); the README documents theVACUUM INTObackup to take first, to a folder outside the repository.No frontend change.
Bug fixed
Two simultaneous requests for a new pair made two paid calls, and the second ended in a 500 on
SQLITE_CONSTRAINT_UNIQUE, discarding its paid text. Concurrent requests for the same pair now share one call.Validation
npm run typecheckclean,npm test190/190, run without an API key (no paid call by the agent at any step).maininmessageFormat.ts,sessionsRouter.tsand the sample/session repositories; every status code and error string ofanalysisRouter.tskept.npm run analyzefor the six ordered pairs of laps 6, 7 and 8: each coach message equals, character for character, the one approved in the research; the lap times are 74.306, 74.144 and 73.372 s. ImplementedPROMPT_VERSION:8c4d40e60f323e80.prompt_versionNULL answers 503; with the current version and model it is served withcached: true.Manual steps
data/telemetry.dbbefore the merge, so the backup is taken before the first start after the merge.claude-opus-4-8, above the documented 1,024-token minimum for prompt caching. Caching of the system block with this model had already been seen working with the previous prompt (cache_write=1380, thencache_read=1380), which also corrected a wrong sentence in the README, CLAUDE.md andcoachService.tsthat said the prompt was below the minimum. The new prompt itself has not been sent to the API yet.Out of scope
totalDeltaS), next spec.promptVersion, the start check againstPROMPT_VERSION, the export's--dry-run..gitattributeseolrules.serverFailFast.test.tsis not hermetic (recorded in the research as debt).CI
Last push: head
da41324, run 40146450927:typechecksuccess,testsuccess (jobs API).