refactor: govern platform complexity and isolate runtimes - #5
Merged
Conversation
added 26 commits
August 14, 2026 14:50
- review_revision: fail closed on unset GATEWAY_SIGNING_SECRET instead of a well-known fallback HMAC key - model-gateway: drop unused ad-hoc probe helpers and zero-caller legacy alias routes - knowledge: drop dead method aliases and the agent getattr fallbacks - tests: guard POSIX-only chmod/stat checks for Windows
One neutral vocabulary shared by memory redaction and the isolated knowledge store; the union only makes detection more conservative.
Single source for stale/near-expiry/review-due/emotion/low-life predicates, the time-variable marker set, and bare-age-answer parsing; search and review no longer carry divergent copies.
Single cosine_similarity in app.vector_util, ClosingSQLiteConnection in app.sqlite_util, and _line_at/_last_touched_line in chunking; removes four divergent copies.
Replace ~13 duplicated snapshot+authenticate+require-admin blocks and 7 commit+reload blocks with two nested helpers.
Move state-file, PID liveness, process identity, and self-probe helpers out of the CLI god-module so the CLI and web console share one implementation.
_monolith is now a pure forwarding facade: the claim/finalize outbox persistence lives in store/chat_finalize.py, and the __getattr__/__dir__ escape hatch in store/__init__.py is gone.
Add the experimental Windows 5.1 release installer, Docker-install validation, and first-class Windows runtime fixes: fsync/chmod/lock handling, PDF Job Object limits, Python 3.14 venv launcher PID tracking, path normalization, and Windows process identity checks.
Make KnowledgeRetrievalService.get_chunks_by_refs async so the agent awaits both retrieval methods directly (drop the pointless run_sync on an async method and the stale comment), and replace 21 hand-written if-not-exists ALTER statements with a single _ensure_columns helper.
POSIX sh in C locale parses the leading byte of full-width punctuation as part of a bare $VAR name, breaking set -u with 'unbound variable'.
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
Why
Complex orchestration and persistence responsibilities had accumulated in large modules and duplicated state machines. That made ownership, rollback behavior, security boundaries, and isolated testing harder to reason about. The configuration cache also relied only on mtimes, so a same-timestamp rewrite could be missed on coarse filesystems.
Impact
External stable routes and attribution contracts remain intact while service internals, Docker/runtime separation, installers, and test seams become more explicit. Configuration reload detection now also considers file size. The new quota helper queries the official GLM monitor endpoint without issuing model inference requests or logging API keys.
Validation
The validation above covers the files changed in the latest commit; the draft remains available for full CI validation of the accumulated branch.