Skip to content

refactor: clarify runtime ownership, result projection and observation lifecycles - #771

Merged
yyjeqhc merged 7 commits into
mainfrom
refactor/runtime-ownership-and-observation
Sep 29, 2026
Merged

yyjeqhc merged 7 commits into
mainfrom
refactor/runtime-ownership-and-observation

Conversation

@Xiiiing

@Xiiiing Xiiiing commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Continue the maintenance work after #770, based on ced97978cb250c1d3b01434c2585d27c9ecda931, in special /root/git/webcodex-review.

Five related work groups, separated into six reviewable commits:

  1. 52691a4d — isolate model result projection from execution dispatch. Move the existing projection policies and their tests to tool_runtime/result_projection.rs; keep execution targeting, prestart denials, permission/Session orchestration and pre-record expectations in dispatch. The existing one-shot plan and pre-compaction audit order remain unchanged.
  2. 3bef3979 — Runtime-owned Git snapshot registries. Remove the two process-global OnceLock registries. Runtime clones share their review/Changes registries; independent Runtime instances cannot read, refresh or evict one another's snapshots. Add clone/isolation/capacity/drop coverage. Existing caller/source fences, review TTL and live/sealed retention classes remain.
  3. f6c64fef — compute current validation evidence from typed summaries. Reuse ValidationSummary directly instead of generating JSON and reading counts/reasons back from it. A private current-source status enum deliberately has no Passed variant; historical success remains separate from unproven current-source evidence. Serialize the existing public shape at the boundary. This is a local domain calculation cleanup, not a redesign of all handoff/continuation JSON ports.
  4. eafb9aa3 — shared UI observation lifecycle. Goal and Session read resources use narrow request slots for single-flight, cancellation, late-response fencing, null/error release and explicit refresh coalescing. Detail/messages progress independently. Goal, Session, Agent inventory and Window collaboration use the shared visibility scheduler. Window resume coalesces for 150 ms. Endpoint renewal and pending sends retain their independent lifecycle and exact mutation identities. Regenerate the checked-in bundle.
  5. 4b518bac — disposable Session ledger scale/recovery experiment and maintenance documentation. Add ordinary small recovery/corrupt-copy tests plus an explicitly ignored larger experiment at 100/1,000/10,000 minimal Sessions. Do not change the production storage engine or evict Active identities.
  6. 5d1395bc — documentation-only retention scope clarification. Numerical quotas are now per Runtime, shared by clones, not an aggregate process-wide cap across deliberately independent runtimes.

Boundaries and scope

  • No new workspace crate, external dependency, user configuration, model tool, direct/gateway policy, public schema or App URI.
  • Snapshot quotas per Runtime: sealed Changes 32 / 8 per caller, live inspection 8 / 2 per caller; independent retention classes, no persistence promise across Runtime/Server restart. This is not a global memory cap across multiple independent Runtime instances.
  • No execution retry, implicit Session selection, weakened authority, new automatic Goal workflow or validation verdict substitution.
  • Shared observation means periodic reads pause when hidden; it does not pause Endpoint leases, cancel sends or automatically replay uncertain mutations.
  • Public validation/closeout ports are not all converted to new DTOs. The change removes the demonstrated self-serialization dependency inside the existing validator.
  • No production data, Server/Runner deployment, service restart, release or merge performed.

Session scale evidence

One local unoptimized test-profile run with synthetic minimally populated Sessions, temporary files, real SessionStore and production snapshot writer:

Sessions Ledger bytes Snapshot lock phase ms Serialize/replace ms Restore ms 200 exact queries ms One close + flush ms
100 71,416 0.185 3.999 6.631 2.263 4.363
1,000 714,916 1.814 37.800 67.549 16.405 46.946
10,000 7,158,916 20.484 374.932 680.137 171.395 398.021

All exact identity and Active/Closed recovery checks passed. These are diagnostic observations, not production capacity limits or optimized throughput claims. Full event tails, concurrent load, RSS, native Windows/macOS storage and power-loss durability were not measured. Existing temp-file/flush/rename persistence is unchanged. Growth suggests investigating write amplification and linear LRU touch cost with representative data before choosing an incremental storage design.

Validation

  • Root default-feature library: 3,097 passed, 3 ignored, 0 failed. Full root coverage was used because projection/Runtime ownership are shared paths.
  • webcodex-validation --lib: 106 passed on final formatted source.
  • Session scale smoke/corrupt-copy: 2 passed, large case ignored by default.
  • Explicit large Session scale/recovery case: 1 passed, all three sizes verified.
  • Frontend TypeScript check; full runtime Vitest 151 passed across 23 files; admin build tests passed.
  • Frontend build and check:dist passed. The large frontend/dist/app.js diff is regenerated bundle output; review the source hooks/tests separately.
  • Workspace dependency boundary: 21 packages pass; test inventory check passes.
  • cargo fmt --all --check and git diff --check pass.
  • Independent review of projection relocation, typed evidence transformations, registry ownership/authority and observation-vs-lease behavior.

Validated implementation tree: 53699bf2764fd7ecf94111a968da5be9ec1816ed at 4b518bac. Final tree: 63a3a29dcfda09bc6a6bd7da071f5107039f740e; the last commit changes two documentation files only, and git diff --exit-code 4b518bac HEAD -- src crates frontend passed. The validation tool's source-freshness metadata reported stale; this is not relabeled as proven freshness. Test results above come from the completed execution and the explicitly compared source tree.

No full workspace/all-features suite, production browser latency benchmark, or native Windows/macOS execution was performed.

Details and reproduction: docs/implementation/runtime-maintenance-boundaries.md, docs/ARCHITECTURE.md, docs/TESTING.md, and docs/agent/ui-progressive-loading.md.

@yyjeqhc yyjeqhc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep-reviewed on the exact current head in special:/root/git/webcodex-review against merged #770 (ced97978). The apparent 9k+/8k+ size is dominated by checked-in frontend bundle regeneration plus an ~1.4k-line model-projection relocation; I reviewed the semantic changes separately. Result projection remains post-record and non-authoritative, Runtime-owned Git snapshot registries preserve caller/project/session fences while isolating independent runtimes, typed validation summaries preserve current-source uncertainty, and UI observation refactors preserve uncertain-write/lease identities. One review finding was fixed in e9eda7bd: an exact Session detail 403/404 no longer turns into a 5-second automatic polling loop; transient errors remain recoverable. Independent validation: root webcodex --lib 3097/3097, webcodex-validation --lib 106/106, frontend runtime 152/152 after the fix, TypeScript check, generated-dist check, and git diff --check. No remaining blocking findings.

@yyjeqhc
yyjeqhc merged commit d462668 into main Sep 29, 2026
@yyjeqhc
yyjeqhc deleted the refactor/runtime-ownership-and-observation branch September 29, 2026 03:15
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.

2 participants