Skip to content

refactor: govern platform complexity and isolate runtimes - #5

Merged
SparkHello merged 26 commits into
mainfrom
codex/complexity-governance
Aug 16, 2026
Merged

refactor: govern platform complexity and isolate runtimes#5
SparkHello merged 26 commits into
mainfrom
codex/complexity-governance

Conversation

@SparkHello

Copy link
Copy Markdown
Owner

Summary

  • isolate stable model-gateway contracts into a dependency-light package and keep Memory/Model runtime responsibilities separate
  • decompose monolithic memory, knowledge, control-plane, upstream-execution, evaluation, and installer paths into focused components
  • harden finalize, routing, installer recovery, configuration reload, and cross-service protocol boundaries
  • add broad boundary and regression coverage plus a read-only GLM Coding Plan quota helper

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

  • 122 affected Memory Gateway tests passed
  • 276 affected Model Gateway tests passed
  • staged diff whitespace validation passed

The validation above covers the files changed in the latest commit; the draft remains available for full CI validation of the accumulated branch.

Spark 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'.
@SparkHello SparkHello closed this Aug 16, 2026
@SparkHello
SparkHello merged commit 826b76d into main Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant