[K8] Prove optional Scarcity Router allocation with durable recovery #28
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Creatidy/creatidy-kernel!28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/k8-scarcity-allocator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
READY_FOR_OWNER_MERGE
Exact approved head:
0dbbff381306596bb947155cda518d70570eda00; basedevelopat367b617c87569080e99c46af7cd4cfefd116e4e2. Both re-verified after review. PR remains unmerged; owner integration only. Keep #11 open until integration.Fresh independent whole-PR review by owner-selected Z.ai GLM-5.3: APPROVE, zero blocking findings. Review #654 is pinned to this head and nonstale: #28 (comment)
Forgejo persists the review as COMMENT, not formal approval, because the shared account is also the PR author. The substantive verdict is explicitly APPROVE. Exact-head CI and all repository gates pass.
Final delivery ledger: #11 (comment)
Review Provenance
am-1790589694495-94a2yu, sessionses_f18898d77ffeGgpvhUgPGovCuw. Actual harness resolution:GLM-5.3 (zai-coding-plan), independently checked by reviewer. No explicit variant override or unreported variant claim.Scope And Baselines
Implements selected #11, preserving K8 as an optional external-consumer ResourceAllocator proof. Parent #3 changes were limited to K8 wording. Same issue, branch and PR throughout.
Upstream public-contract/reuse baseline: Scarcity Router
81b8e6393a1b2df8a6c7a9c6c3dcb8a7f6884e4e, merged D-057 / #148 / PR #149. Nine upstream effort-serialization tests passed at that pinned source. Public candidate effort is explicit catalog-sourced string/null, independent of opaque variant. No Router Python dependency or internal imports.Changes
POST /v1/selectallocator with exact independently configured Runtime bindings, bounded opaque provenance, explicit refusal/errors and no fallback selector.Separate Acceptance Evidence
Validation
make check: PASS, 757 tests, formatting/lint/BasedPyright/import boundary/secret scan/diff checks.make package-check: PASS, LICENSE/NOTICE distribution, sdist rebuild equality, zero-dependency isolated install and reference replay/export.make audit: PASS, no known vulnerabilities.Review #653 requested changes on old head
31bf956; the receipt/identity defect was remediated in0dbbff3and reviewed afresh. Remediation record: #28 (comment)Boundaries And Limitations
Kernel retains Program authority, execution/recovery, verification/acceptance/outcomes and Forge effects. No gateway/prompt proxy, shadow policy, access-mode inference, reservations, adaptive rerouting, main/release/deployment changes. Acceptance tests use no live provider execution or paid inference.
Only the bounded reference capability/context mapping is supported. Runtime support is separately configured evidence, not inferred from names. OS DNS retains its resolver timeout; response I/O is bounded. Conservative echoed-token checks may refuse public/short-token collisions as documented. Trusted-development fixtures do not claim hostile-worker isolation. Reviewer's strictness notes are nonblocking; no speculative follow-up issues created.
Final ledger: valid full reviews=2; remediation_used=1/10, remaining9. Terminal state READY_FOR_OWNER_MERGE. Worktree clean; review polling cancelled. Any new implementation head requires a fresh review.
PR Review: [K8] Prove optional Scarcity Router allocation with durable recovery (#28)
Repository: Creatidy/creatidy-kernel
Branch: feat/k8-scarcity-allocator -> develop
Frozen head:
31bf956119b0c5ead312b19ea408295a6b3b5d03Linked issue: #11
Summary
The public D-057 contract gate, attribution, dependency direction, immutable Allocation preparation, no-reselection behavior, exact non-null effort dispatch, and happy-path two-WorkUnit proof are well covered. The exact frozen head is not ready to integrate because native runtime recovery loses required resolved identity at one committed crash boundary.
Intent / Acceptance Evidence
docs/architecture/reuse.md,NOTICEArchitecture / Information Flow
The change preserves
adapters -> ports -> core, keeps Router policy and gateway behavior outside Kernel, and separates recommendation, durable Allocation, runtime identity, Program acceptance, and Forge delivery. Allocation/context bytes are durably bound before dispatch and existing Attempts do not reselect.Blocking Issues
ports/application.py:188-192records the accepted handle and exposes thereceiptcrash boundary before the first identity artifact is written atports/application.py:226-232. On process restart,CodexRuntime.restore()reconstructs_Runonly from thread/turn IDs (adapters/codex_runtime.py:247-260);thread/readrecovers status but not model/provider/effort (adapters/codex_runtime.py:263-299). The restored observation therefore has allresolved*fields unset, and the application returnsidentity_unavailablebecause no prior durable identity exists.reference_live.py:248-263then stops, so a completed first WorkUnit can never be accepted and the second WorkUnit is never created. This violates the issue's restart/two-WorkUnit criteria and the runtime contract's durable identity requirement. Persist recoverable resolution evidence atomically with the accepted receipt, or make native reconciliation re-establish and validate it before acceptance.Non-blocking Suggestions
ports/allocation.py:196-200accepts every resolved/observed effort when the Allocation effort isNone. This allows malformed values or contradictory later observations to pass independently of the persisted resolution. Validate the identity shape before publication and compare any non-null current observation with the immutable recorded resolution.adapters/scarcity_router.py:135-145,292-295,397-398accepts short visible-ASCII bearer tokens but rejects any response containing the token as a substring anywhere. Valid tokens such asopenai,high, or1can collide with ordinary response content and make every authenticated selection fail. Either constrain credentials so accidental collisions are not accepted configurations or narrow the leak check.Questions for the Author
None.
Security / Privacy Notes
No blocking credential disclosure, TLS bypass, redirect-following, policy-shadowing, or execution-authority issue was found. Residual transport evidence is synthetic: certificate/hostname failure is asserted through a mocked SSL context rather than a real TLS failure, and OS DNS resolution remains outside the adapter deadline as documented.
Test / Documentation Gaps
tests/test_allocation_recovery.py:152-188coversreceipt, but reuses the same in-memory runtime object after reopening SQLite, preserving resolution state that a process restart loses.tests/test_reference_scarcity.py:174-200reconstructs the native path only after deliberately crashing after the identity artifact is durable. Add a native process-reconstruction regression that crashes immediately after receipt and before identity publication.Follow-Up Candidates
None. The missing receipt-boundary recovery is required by issue #11 and belongs in this PR.
Overall Recommendation
REQUEST_CHANGES
Blocking findings: 1. The review is limited to frozen head
31bf956119b0c5ead312b19ea408295a6b3b5d03; any remediation requires a fresh exact-head review.Remediation 1 complete; fresh whole-PR review pending
New head
0dbbff381306596bb947155cda518d70570eda00, same base367b617c87569080e99c46af7cd4cfefd116e4e2. Resolves review #653's blocking receipt/identity crash window without a schema change or extra execution authority.The generic application now atomically publishes the native handle, delivery fence and actual configuration snapshot in one immutable
runtime-receiptartifact before accepting that receipt in operation state. Restart can replay publication-to-acceptance recovery and reconstruct identity after acceptance, with zero new allocation or native starts. The separate exported identity remains original runtime evidence, not a copy of requested configuration. Existing records genuinely lacking resolution still fail closed.Discriminating native fixtures recreate CodexRuntime/controller state at (1) receipt evidence published but not accepted, (2) accepted receipt before identity publication, and (3) identity publication. Each is crossed with Router outage and changed recommendation; the original Attempt is accepted unchanged, followed by the second WorkUnit and existing Forge effect. The external native fixture retains server-side state, not the discarded adapter's resolution cache.
Also addressed the nonblocking null-effort identity concern: malformed identity fields and contradictory non-null later resolution/observations are rejected even for unconfigured Allocation effort. Tests prove unknown values do not erase the original known resolution.
Credential-collision suggestion disposition: retain conservative refusal rather than weakening protection against credential echoes or inventing a new upstream token syntax. README now explicitly documents that short/public-name credentials can collide with public decision strings and must not be used as opaque secrets. This is a safe-refusal limitation, not a successful authentication guarantee or disclosure.
Validation at new head:
make checkPASS (757 tests, all lint/type/import/secret/diff gates);make package-checkPASS;make auditPASS. No live inference. Prior 737-test evidence remains historical to head31bf956.Owner now requires GLM-5.3/Z.ai instead of GPT-Sol; next review routing preserves L4 and reasoning/coding/tool_use 5/5/5 with reasoning/tool use required and constrains provider/model accordingly. Review count 1, remediation_used 1/10; prior REQUEST_CHANGES verdict is not treated as approval of this new head. No merge.
OWNER_MODEL_OVERRIDE: fresh review dispatched
Owner override supersedes the automated-routing blocker for this review boundary only; it does not change implementation, Router policy or the historical routing result. Head remains
0dbbff381306596bb947155cda518d70570eda00, base367b617c87569080e99c46af7cd4cfefd116e4e2.Actual dispatch: one fresh local Agent Manager session, exact catalog model GLM-5.3, provider zai-coding-plan (Z.ai). No variant override was specified by the owner or invented by the dispatcher. No fallback.
Agent Manager request
am-1790589694495-94a2yureturned explicit harness resolution:This establishes DISPATCH_VERIFIED for the required model/provider; no unreported reasoning variant is claimed. The initial prompt supplies only the owner review mandate, frozen head/base, current issue acceptance checklist and read-only workflow, not the implementer conversation or a prior verdict as authority. Full-PR review is required, not a remediation-only pass.
Distinct evidence states: automated routing NO_SELECTION (historical); explicit override OWNER_MODEL_OVERRIDE; actual dispatch REQUESTED; model/provider DISPATCH_VERIFIED; reviewer completion PENDING; substantive verdict PENDING; current-head Forgejo review state absent. Existing exact-head local gates and CI #2039 remain green. No Router calls/mutations, code changes, merge or deployment in this boundary. Review budget remains remediation_used=1/10 until a valid substantive review requires further remediation.
PR Review: [K8] Prove optional Scarcity Router allocation with durable recovery (#28)
Repository: Creatidy/creatidy-kernel
Branch: feat/k8-scarcity-allocator -> develop
Frozen head:
0dbbff381306596bb947155cda518d70570eda00(re-verified via Git transport and Forgejo MCP before and after review; merge-base = base)Base:
developat367b617c87569080e99c46af7cd4cfefd116e4e2Linked issue: #11
Reviewer dispatch: OWNER_MODEL_OVERRIDE (issue #11 comment 12594), not a Scarcity Router selection. Harness resolution recorded in PR comment 12598:
session: GLM-5.3 (zai-coding-plan)for Agent Manager requestam-1790589694495-94a2yu; no variant override, no fallback. Independently validated by this reviewer session.Summary
Fresh whole-PR review of the remediated head. The optional
ScarcityRouterAllocatorconsumes only the public D-057POST /v1/selectcontract with exact explicit effort; generic Prepare now binds original allocation/context bytes atomically with the immutable Attempt and operation intent; recovery reconstructs original bytes with zero re-selection at every committed boundary; the native handle plus configuration snapshot are durably published together before receipt acceptance, closing review #653's blocking crash window; requested/resolved/observed identities remain distinct evidence; the K7 two-WorkUnit scenario, verification/acceptance/successor input, and the AGit Forge path are unchanged. Attribution (NOTICE) and packaging are correct. No blocking findings.Intent / Acceptance Evidence
81b8e639D-057 verified, 9 upstream tests);docs/architecture/reuse.md,NOTICEadapters/scarcity_router.pyconsumes only/v1/select; unsupported capabilities/runtime mismatch raiseAllocationUnavailableselected=null; malformed; schema version; missing identity; unreachable; auth; exact-effort unavailable; runtime incompatibility; no fallbacktests/test_scarcity_router.py(exactly 94 cases, counted): 9 HTTP statuses incl. 401/403, 27 malformed-field cases, 10 strict-JSON cases, null-vs-"none"-vs-missing effort, alternatives never used as fallbackports/application.pyselect-only-when-Attempt-absent + atomicadmit_with_intentwith original bytes;tests/test_allocation_recovery.py8 boundaries x 2 replacements withcalls == 0;tests/test_reference_scarcity.py3 native boundaries x outage/differentadapters/codex_runtime.pythreadconfig.model_reasoning_effort+ turneffort; receipt equality enforced before turn; resolver omission raisesExecutionConflict;supported_effortstrusted bindings; observed attestation refusedtest_router_native_two_work_unit_proof: 2 router calls, 2 native starts/turns, 1 PR,first\n/first\nsecond\n, predecessor binding enforced by runtime and storeadapters/reference_forge.pyuntouched by the diff; exports assertautomatic_merge/automatic_deployfalsetests/fixtures/scarcity_router_selected.jsonsynthetic producer-shaped; full suite offline; FixedAllocator unchanged and still defaultmake check,make package-check,make audit; independent review; issue open, PR unmergedReviewer-executed validation at frozen head
0dbbff381306596bb947155cda518d70570eda00:make checkPASS (757 tests, ruff format/check, basedpyright, lint-imports 1 contract kept, secret scan,git diff --check);make package-checkPASS (wheel LICENSE/NOTICE equality, sdist rebuild, zero-dependency isolated install, reference replay/export);make auditPASS (no known vulnerabilities). Forgejo CI run #2039 (actions run 62) SUCCESS at the exact SHA, verified via MCP.Architecture / Information Flow
adapters -> ports -> corepreserved:ports/allocation.pyimports only core +ports.program_store;adapters/scarcity_router.pyimports core resources and the ResourceAllocator port; zero new runtime dependencies (stdlibhttp.client/ssl/socket/threadingonly;dependencies = []still enforced). Router policy, ranking, quota semantics, and the execution gateway remain outside Kernel; the adapter maps only the boundedreferencecapability/context request and treats opaque decision records as untrusted provenance. Recommendation, durable Allocation, Runtime identities, Program acceptance, and Forge effects remain distinct evidence chains. The prior K7 select-before-Attempt-lookup defect is corrected: selection occurs only when no Attempt exists, and Prepare commits the Attempt and the operation intent carrying the original allocation/context bytes in one transaction; artifacts are later finalized from those original bytes with digest verification, and missing/corrupt evidence fails closed (CorruptHistory/ValueError) rather than reselecting.Blocking Issues
None (0). The single blocker from review #653 — loss of resolved provider/model/effort when the process stopped after the accepted native receipt but before identity publication — is remediated at this head:
runtime-receipt(handle, fence, identity snapshot) is finalized before receipt acceptance, replay is fence/reference/identity-validated on recovery, and identity publication uses the durable receipt snapshot withrequire_resolved=True. Regressions prove completion after that exact crash (test_codex_receipt_crash_recovers_original_resolution_before_identity_publication) and no duplicate native starts across receipt-evidence/receipt/identity boundaries crossed with Router outage and changed recommendation, while records genuinely lacking resolution still fail closed.Non-blocking Suggestions
_decisionpinsselector_mode == "balanced", a closed selection reason-code set, and a canonically identical requirement echo. Future additive Router evolution (new selector mode or reason code) will be refused until the adapter is re-reviewed. This is deliberate bounded-consumer strictness (andreuse.mdalready requires explicit public-contract review on upstream change); no change requested.[a-z0-9][a-z0-9._:-]{0,63}. Current public identifiers fit; identifiers outside this grammar would be refused. Fail-closed; acceptable.ScarcityRouterUnavailablemessage; the status class is not surfaced on the exception (only null-selection retains decision provenance). The port contract does not require finer granularity; an operator-facing diagnostic channel could be added later.__post_init__swallowsTypeError/OverflowErrorinto "invalid ... configuration", making construction-time type errors indistinguishable from invalid configuration. Cosmetic.Questions for the Author
None.
Security / Privacy Notes
Verified TLS defaults asserted (
CERT_REQUIRED, hostname check), HTTP restricted to literal loopback, redirects never followed, error bodies never inspected or echoed, bearer credential excluded fromrepr, exceptions, and durable provenance (unicode-escaped echo case covered), bounded response bytes/JSON depth/total deadline with trickle and truncated-Content-Length coverage, duplicate-key and nonfinite-number rejection, and no raw hostile content in exception chains. No secrets introduced; repository secret scan passes. Residual, previously documented limitations unchanged: TLS certificate failure is evidenced via a mocked context rather than a live TLS failure, and OS DNS resolution remains outside the adapter deadline.Test / Documentation Gaps
None blocking. Adapter case count (94), total test count (757), and all gate/CI claims in the PR body were independently reproduced or verified. README/reuse.md/NOTICE statements match the actual code behavior at this head; planned/live-capability wording is accurate (no live-provider execution claimed).
Follow-Up Candidates
None. The strictness notes above are documentation-level positions already recorded in
docs/architecture/reuse.mdand README.Overall Recommendation
APPROVE — blocking findings: 0, at frozen head
0dbbff381306596bb947155cda518d70570eda00only. Per the owner override in issue comment 12594, unchanged green validation/CI plus this zero-blocker APPROVE satisfies the review condition forREADY_FOR_OWNER_MERGE; merge remains an owner decision and must not be performed by automation. Any new head requires a fresh review.