Repository navigation
feat: --serve answers vocabulary replays from one warm process - #380
Conversation
Replays launched the binary once per dictation and once per answer, and each launch reloaded the models. --serve reads one JSON request per line (dictate, picked, correction, learn, reset) and runs the same functions the separate flags run. Places come back as the stage's own log lines. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2 Signed-off-by: Nathan Zylbersztejn <[email protected]>
reset empties vocabulary.yaml and vocabulary-uses.yaml. Run against the default config, it would erase the vocabulary someone dictates with. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2 Signed-off-by: Nathan Zylbersztejn <[email protected]>
|
Automatic reviews are disabled for this repository. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
@coderabbitai review |
Action not completed
|
|
CodeRabbit review (local CLI 0.8.0). The GitHub app is rate limited on this repository, so this review ran with |
ParrotFlow --servekeeps one process alive with its models loaded. It reads one JSON request per line on stdin (dictate, picked, correction, learn, reset) and answers one JSON line on stdout. Each request runs the same function as its separate flag, writes to the config dir included. Vocabulary replays used to launch the binary once per dictation and once per answer. One pass over the 165 bench decisions, both flags and both floors, now takes 2 minutes instead of 29, with every decision and every output identical. No setting changes and no existing command changes. Start withServeCommand.swiftand the extraction inPipelineCommand.swift.The protocol: five commands, places come back as the stage's own log lines
Each answer has
id(echoed),cmd,code(the separate flag's exit code),said(the lines it prints) andlog(the lines this request wrote to the log, without the timestamp).dictateaddsoutandvars, the values--varsprints. A bad line answers{"id", "error"}and the loop goes on. End of input exits 0.dictaterunsPipelineCommand.dictate: the fixture is decoded again on every call, then the--quietpath, which is the one the app uses.picked,correctionandlearncallSoundGroupCommand.picked,SoundGroupCommand.correctionandLearnCommand.run. Those three now take asayparameter that defaults toprint, so the CLI output is unchanged.Logsink returns what the vocabulary stage wrote, and a harness parses those lines as it parsed the log file.resetwritesterms: {}to both files. It refuses withoutPARROTFLOW_CONFIG_DIR, so it never empties the vocabulary someone dictates with.dupof stdout. fd 1 then points at stderr, so a strayprintcannot corrupt an answer.clause_decider.Equivalence: per launch against warm, every decision and output identical
The three replay harnesses were ported to a backend switch: one launch per call, or one
--serveprocess per run directory. They are local, in the scratchpad andtraining/, and not in this PR.Compared per item: output text, places with decisions and terms, simulated answers and what they printed, the vocabulary log lines (timings masked), and the final
vocabulary.yamlandvocabulary-uses.yaml. The serve runs also match the #379 per-launch runs on disk, decision for decision.One difference showed up first and was not this mode. espeak-ng exits 1 when HOME is 158 bytes or longer (157 works, measured on real directories), and the sound pass then loses its first ear. The two arms' run directories differed in length, so one arm had a 159-byte HOME. With short run directories, both arms are identical. The harnesses now assert a short HOME.
Speed: 11 to 17 times faster per pass
Wall time per pass, model load included (one
--serveprocess per run).First use: the 165 bench over 20 random orders, both flags, in 43 minutes
The same seeds as the Python replay (orders from
default_rng(12345), fixes from seed k+1). Mean over the 20 orders, chrono in brackets. 84 runs, 2,590 s of wall time in all; per launch this would take about 5 hours.How it was checked
scripts/check-serve.sh(new, inmake testand CI): 32/32. One server driven request by request through fifos. Eachsaidequals what the separate flag prints, andvocabulary.yamlandvocabulary-uses.yamlmatch the separate commands byte for byte. No model needed.--pipeline ... --vars --warmon 32 sentences per flag (sound fixtures at 0.85 and 0.60, rule fixture), plus 8--learn/--correction/--pickedcalls per flag. Base 1ede563 against this branch: byte-identical stdout and files.scripts/check-pipeline.sh134/134,check-sound-group.sh93/93,check-learn.sh45/45,check-clause-places.sh9/9, all under a scratch config and home.resetwithout a scratch config dir. Declined: "install PyYAML for check-serve"; the workflow already installs it in the same job, andcheck-join.shrelies on it too.🤖 Generated with Claude Code
https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2