fix(serve): close the resident-process staleness and growth holes - #957
Merged
Conversation
Adversarial review of the serve design surfaced three weaknesses a one-shot CLI never had, because it never lived long enough: - Pricing-affecting config (model aliases, price overrides, local-model savings) now participates in the parse memo key. Config reloads fresh per request (the preAction hook), but a memoized or burst-reused parse embedded costs priced under the OLD config; the widened key makes any such change an automatic memo miss. New alias-hash helper + tests. - Memory guard: past 3GB RSS the serve loop drops its in-memory memos (session cache + parse entries) and the next request re-parses once. The child never exits for this, so the client's death budget is untouched. - codeburn serve typed in an interactive terminal now explains itself on stderr instead of hanging silently on stdin.
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.
Devil's-advocate pass over #956, fixing what survived scrutiny:
Attacks that did NOT survive (verified safe): config mutations reaching the child (preAction re-reads per request), orphaned children on app crash (stdin EOF ends the serve loop), request timeout mid-parse holding the refresh lock (#855 recovery handles the SIGKILL'd holder), option-state leakage (fresh program per request, pinned by test).
Full suite green; alias-hash covered by new tests; one-shot output unaffected (key widening only adds terms that are constant within a single run).