Repository navigation
fix(local): harden turbo-fieldfare HTTP adapter, /v1/systemone parity, and CI coverage - #113
Merged
Merged
Conversation
… CI coverage Refs #112
ghchinoy
approved these changes
Dec 2, 2026
ghchinoy
added a commit
to ghchinoy/dgem-official-fork
that referenced
this pull request
Dec 2, 2026
… diagnostics.timing.reused_tokens Addresses GoogleCloudPlatform#108 (rebased cleanly onto GoogleCloudPlatform#113): - Accumulates readout.get('reusedTokens') or 0 into the lock-guarded self._timing_acc dict in scripts/turbo_fieldfare_server.py so prefix KV cache telemetry accumulates accurately across isolate:all and samples>1 worker threads and tolerates JSON null values. - Adds test_reused_tokens_accumulates_across_isolated_and_multi_sample_reads in scripts/test_turbo_fieldfare_server.py.
1 task done
ghchinoy
added a commit
to ghchinoy/dgem-official-fork
that referenced
this pull request
Dec 2, 2026
…rk link, --verify-install, NOTICE, RAM tiers, and provenance Addresses PR GoogleCloudPlatform#109 review items (rebased cleanly onto merged GoogleCloudPlatform#113): - Link public ghchinoy/turbo-fieldfare (feat/diffusiongemma-probe) fork, build TurboFieldfareRepack in launch steps, and fix --verify-install syntax to '--verify-install --input-gturbo <path>' in both docs and scripts/download_turbo_fieldfare.sh. - Add mlx/mlx-lm and ~50 GB temp BF16 download space to prerequisites. - Clearly state turbo-fieldfare capability boundaries vs diffgemma (structured text decisions only; no dgem ask plain chat, think>0, steps>1, or images; 4,096 default context; fixed seed_token default). - Update NOTICE with MIT license for mmastrac/diffgemma, upstream vLLM copyright line, scope notes, neutral wording (no default/optional drift), and bundle NOTICE in .github/workflows/release.yml archives. - Align Tier B minimum RAM to 24 GB (>= 22 GiB auto-select), align script warnings with combined probe+adapter footprints, state Apple M5 32 GB macOS 26.7.3 provenance (marking 8 GB row projected), clarify -u vs DGEM_LOCAL_URL, and title Section 3 Prerequisites (diffgemma).
This was referenced Dec 2, 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.
Refs #112 (tracks alongside #108; follow-up hardening to #106 and #107).
Summary
Wire contract and parity (
scripts/turbo_fieldfare_server.py)POST /v1/systemone(and/systemone) to matchdeploy/cloudrun/server/structured_server.py: parses canonical{"state", "questions"}bodies withjev_schemaandjev_state, enforcescheck_media_keys, rejects non-emptyimageswith HTTP 400, returnsjev_answershapes plusmodel,usage, anddiagnostics, and attaches_timing_headers(body).POST /v1/chat/completionsto require exactly two messages (systemordeveloperfollowed byuser), accept text-only content part lists viamessage_textwhile rejecting image/audio/video parts with HTTP 400, and return structured{"error": {"message", "type"}}JSON across all error paths.steps > 1with HTTP 422 on/v1/systemoneand HTTP 400 on/v1/chat/completions(matchingthink > 0), and addedensure_ascii=Falsewhen serializing dict states so non-Latin text is not\uXXXX-escaped.HTTP/1.1 hardening and input validation (
scripts/turbo_fieldfare_server.py)Handler.timeoutfromHTTP_IDLE_TIMEOUT(default120s,0disables) to matchstructured_server.py(issue perf(decisionindex,gateway): parallelize independent multi-pass /v1/systemone batches and Round-1 brackets #96)._discard_body()on401and415refusals, and closed connections (Connection: close) onTransfer-Encoding, invalid or negativeContent-Length(400), oversized bodies (413, default16 MiB), or truncated reads so keep-alive connections stay synchronized.Content-Type: application/jsononPOSTroutes carrying JSON (emptyPOST /readystill works without it).MAX_INFLIGHT/INFLIGHT_WAIT_Sreturning HTTP 503 (overloaded).--addrbinds unlessDGEM_SERVER_KEYis set, and fixedparse_addr+ server socket family for bracketed IPv6 addresses ([::1]:8080).parse_seed()inside the requesttryblock to preserveseed=0and reject booleans, non-integers, and non-scalars with HTTP 400/422.Probe lifecycle, timing, and #107 follow-ups
start_timeout_sandread_timeout_sdeadlines using reader threads and queues so a hung probe never blocksclose(). Verified responseid, mapped probe{"error": ...}payloads andmax_contextoverflows to HTTP 4xx, invalidated on malformed JSON, and added backoff-guarded auto-restart."ready" in line.lower()with word-boundary checks rejecting"already","not ready", and"unready".httpdwith exit code1when initialworker.start()fails inmain().self._tls.timing_accwith a lock-guarded instance accumulator soprefill_ms,denoise_ms, andhead_msaccumulate acrossread_many()(samples > 1) andThreadPoolExecutor(isolate: "all"/"auto"), and guarded JSONnulltiming values withor 0.0.sys.modulesinload_structured_server()sopybase64/transformersstubs do not leak across combinedunittestruns.DEFAULT_SEED_TOKENenvironment variable (still defaulting to"fixed"when unset, validated againstSEED_TOKENS).Shell scripts, Go status, and CI
scripts/serve_turbo_fieldfare.sh: honoredTURBO_FIELDFARE_SRCfor probe and model fallback paths, and exited1when/readytimes out after 60 s instead of exiting0.scripts/download_turbo_fieldfare.sh: honoredTURBO_FIELDFARE_SRCforTurboFieldfareRepackdiscovery and printed a clearerNOT VERIFIEDwarning when the verifier is absent.scripts/stop_turbo_fieldfare.sh: validated numeric PID and verifiedps -o command=containsturbo_fieldfare_server.pybefore signaling, and narrowedpkill -fpatterns so they do not matchswift build, open editors, or wrapper shells.cmd/mcp.go: preserved an explicitly configured--modelflag or non-defaultmodelvalue instead of overwriting it from local/v1/models..github/workflows/build.yml: addedpython -m unittest -v scripts/test_turbo_fieldfare_server.pyandbash -n scripts/*turbo_fieldfare*.shtotest-matrix.pkg/client/turbo_fieldfare_test.goandcmd/backend_local_test.go: updated the mock error shape and comment, addedTestLocalBackendStatusPreservesExplicitModel, and addedTestTurboFieldfarePythonAdapterContractexercisingclient.Decideagainstscripts/turbo_fieldfare_server.py(python3 >= 3.10).Still open on #112 (not changed here)
turbo-fieldfare-dgemfork URL and commit inscripts/setup_turbo_fieldfare.sh(pending publication of the fork).scripts/download_turbo_fieldfare.sh:36--verify-installsyntax to--verify-install --input-gturbo <path>(left untouched until confirmed against the fork so existing fork builds do not break).Note on open PR #111
reused_tokensto the lock-guardedself._timing_accdict inscripts/turbo_fieldfare_server.py(resolving the thread-local drop onisolate: "all"andsamples > 1).Verification
python3 -m py_compile scripts/turbo_fieldfare_server.py scripts/test_turbo_fieldfare_server.pypython3 -m unittest -v scripts/test_turbo_fieldfare_server.py(20/20 OK, 0 resource warnings)python3 -m unittest scripts/test_turbo_fieldfare_server.py deploy/cloudrun/server/test_server_key.py deploy/cloudrun/server/test_media_fields.py(31/31 OK)bash -n scripts/*turbo_fieldfare*.sh/tmpchecks verifyingdownload_turbo_fieldfare.shNOT VERIFIEDwarning +TURBO_FIELDFARE_SRCdiscovery, andstop_turbo_fieldfare.shskipping unrelated PIDsenv -u DGEM_VERTEX_URL go vet ./...env -u DGEM_VERTEX_URL go test -race ./pkg/client/... ./cmd/...(includesTestTurboFieldfarePythonAdapterContractandTestLocalBackendStatusPreservesExplicitModel)