[K3] Prove synthetic execution, workspace and authority boundaries #18
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!18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-6-synthetic-execution"
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?
Implements #6. Keep issue open until owner integration into
develop.Validation on HEAD
97ac9661709310d701adb790e0afcafc9d33b21d:uv run --locked pytest tests/test_fake_authority.py tests/test_fake_execution.py tests/test_k3_integration.py(12 passed);make check(164 passed, formatting, lint, basedpyright, boundaries and secrets);make package-check(wheel/sdist/isolated install).make auditpassed before the code-only remediation; dependency and tooling files unchanged. See issue #6 delivery ledger for review/correction provenance.PR Review: [K3] Prove synthetic execution, workspace and authority boundaries (#18)
Repository: Creatidy/creatidy-kernel
Branch: issue-6-synthetic-execution -> develop
Frozen head:
3cf0b229a1(base059482d045; head confirmed unchanged before and after review)Linked issue: #6 (from PR body "Implements #6")
Reviewer context: fresh read-only session; local checkout verified identical to the frozen head; no implementation-session context used. Note: an
APPROVED-state review was attempted first; Forgejo rejected it because the PR author and the review identity are the samekiloaccount ("approve your own pull is not allowed"). The verdict below stands on its evidence; the formal approval state must come from a different account or the owner.Summary
Adds core execution/authority values,
ports/execution.py(Runtime,Workspace) andports/authority.py(AuthorityBroker) protocols, deterministicFakeRuntime/FakeWorkspace/FakeAuthorityBrokeradapters, three test modules (unit + K2B/K1 integration), and honest README/threat-model updates. 11 files, +1088/−3. Dependency direction is clean: core imports only core; ports import core; adapters import ports+core;lint-importscontract kept. No vendor imports, no new dependencies.Intent / Acceptance Evidence
ExecutionRequest.__post_init__binds attempt/workspace/context/allocation/agent-definition references (src/creatidy_kernel/core/execution.py:166);FakeRuntime.publishvalidates attempt_id/spec_digest/workspace binding and marks terminal;FakeAuthorityBroker.issue/revokeare owner-only; integration test ends with ownerFinishAttemptand WorkUnitREADY(candidate does not satisfy) — tests/test_k3_integration.py:39FakeRuntime(recoverable=False)/lose()/wrong-handle reconcile →Presence.UNKNOWN;identity_supported=False→ resolved/observedNone; duplicatestartreturns same handle, changed inputs →ExecutionConflict; candidate replay identical/no-op, changed → conflict — tests/test_fake_execution.py:83fresh_until(waiting at now=299 with fresh_until=300);reconcilerequires exactOperationKeyequality and optional exact handle — tests/test_fake_execution.py:103AuthorityGrantrestricts operations ⊆WORKER_OPERATIONS; workspaceaccessdenies control-plane ops and path/symlink/network/mount escapes; stalescope.fencepublish → conflict;store.observewith fence−1 →OperationConflict— tests/test_fake_authority.py, tests/test_fake_execution.py:111, tests/test_k3_integration.py:136Runtime/Workspacein tests;make checklint-imports "Adapters depend inward… KEPT"; stdlib+pytest onlyTrustMode.ISOLATED→UnsupportedExecutioninFakeWorkspace.materialize; docstrings "never a hostile-code sandbox"; README + threat-model updated to state no OS isolation/credential broker/live workerAll six criteria are met with observable evidence.
Architecture / Information Flow
Conforms to
adapters -> ports -> coreand ADR 0004/0005 vocabulary: start receives immutable Attempt + explicit workspace/context/allocation/capability references + Operation identity and fence; observe/cancel/candidate/reconcile distinguish found/absent/unknown; requested/resolved/observed identity and agent-definition version recorded separately; single-use grants are consumed atomically with the Operation intent and exact replay does not re-consume or authorize different content (ADR 0005). Integration uses K2Badmit_with_intent/claim/record_transport/observesignatures exactly as they exist; domain acceptance stays separate from transport status. Stale-fence publication rejected on both runtime scope and journal fence.Blocking Issues
None found.
Non-blocking Suggestions
check_scope(src/creatidy_kernel/core/authority.py:86) compares the resolved target(grant.root / intent.path).resolve()against unresolvedgrant.paths. If the grant root or an allowed path contains a symlinked component (macOS/tmp→/private/tmp, symlinkedTMPDIR), in-scope paths are spuriously denied and the symlink-escape test could fail in the other direction. Resolve the allowed paths once (or compare resolved-to-resolved) so the check is environment-independent.FakeWorkspace.access(src/creatidy_kernel/adapters/fake_execution.py:70) enforces a hardcoded control-plane denylist while core definesWORKER_OPERATIONSas the positive vocabulary. Checkingoperation in WORKER_OPERATIONSwould use one vocabulary and also reject operation names no grant can confer.FakeRuntime.candidate/progressraiseKeyErroron unknown handles whereobserveraisesExecutionConflict, and core/execution.py mixesValueError(from_text) withExecutionConflictin validation paths.Questions for the Author
WorkspaceSpeccarries no lifetime field and cleanup is gated only onworker_settled. Is lifetime deliberately deferred to the runtime/reconcile path? If so, a one-line note in the port docstring would keep code and ADR aligned.docs/architecture/contracts.mdlists workspace conformance case "partial launch" and authority case "overbroad provider credential"; neither is simulated here. Confirm these are intentionally left to the real adapters rather than forgotten.Security / Privacy Notes
Honest boundary labeling throughout: trusted-development fakes are documented as policy simulation,
ISOLATEDfails closed, control-plane operations never reachable through worker scope, grants cannot confer control authority, authentication is explicitly trusted-channel (ports/authority.py docstring). No secrets, no network access, no live external effects;tools/check_secrets.pyclean. Informational: core/authority.py performs live filesystem checks (root.is_dir(),Path.resolve()), which is fine for a synthetic enforcement simulation but makes that module's behavior filesystem-state-dependent (see suggestion 1).Test / Documentation Gaps
WorkspaceSpeclifetime omission (question 1).Follow-Up Candidates
None durable enough to warrant an issue now; the unexercised conformance cases belong to the future real workspace/authority adapters and are already pinned in contracts.md.
Validation
Reviewer-run against the frozen head: focused tests
uv run --locked pytest tests/test_fake_authority.py tests/test_fake_execution.py tests/test_k3_integration.py→ 10 passed;make check→ uv lock check, ruff format/check, basedpyright, lint-imports contract kept, 162 tests passed, secrets scan clean,git diff --checkclean;make package-check→ wheel/sdist rebuild and isolated install passed.make auditnot re-run by reviewer: this PR changes no dependency or tooling files (uv.lock/pyproject untouched), matching the validation rules' relevance condition; the PR reports it passed.Overall Recommendation
APPROVE — for the frozen head
3cf0b229a1only. Integration and issue closure remain owner-controlled.Architecture / model-correction assessment (not a full approval review)
Frozen head:
3cf0b229a1(base059482d045), verified unchanged in this session.Question assessed: review #602's claim that single-use grants are "consumed atomically with the Operation intent", versus the separate in-memory
FakeAuthorityBrokerledger and tests callingstore.admit_with_intentbeforebroker.check— violation of issue #6 or ADR 0005?What the frozen head actually does
FakeAuthorityBroker.check(src/creatidy_kernel/adapters/fake_authority.py:41) performs replay lookup, effect-key exclusivity, single-use consumption, intent registration and effect binding inside one lock. Consumption is atomic within the broker's in-memory ledger, and the ADR semantics hold there: exact replay returns the recorded intent without re-consuming (adapters/fake_authority.py:47, tests/test_fake_authority.py:57), changed input under the same operation identity is denied (:49, tests/test_fake_authority.py:59-66), a second operation cannot use a consumed grant (:54, tests/test_fake_authority.py:67-68), and replay still rechecks revocation/expiry (:46, tests/test_fake_authority.py:100).store.admit_with_intent(src/creatidy_kernel/adapters/sqlite_store.py:349) commits the K1 decision plus operation/outbox row in one SQLite transaction; the integration test caller-composes the two (admit_with_intent at tests/test_k3_integration.py:65, broker.check at :98). There is no cross-store transaction, and the code states this honestly: adapters/fake_authority.py:2 ("In-memory synthetic admission; not the durable Operation journal"), the PR body ("not ... durable authority journal"), tests/test_k3_integration.py:2 ("not a second journal").Verdict on the question
OperationIntentvalue the broker consumes, and an overstatement only if read as "atomically with the SQLite intent admission". The defect is in the review's wording, not in the PR.Classification
BOUNDED_CORRECTION — finite in-scope changes, no owner architecture/scope decision required:
AuthorityBroker.checkport docstring stating that durable consumption-atomicity with the Operation journal is an obligation of the real broker adapter, not of synthetic fakes.WorkspaceSpec(src/creatidy_kernel/core/execution.py:71) carries no lifetime field while ADR 0004 requires workspace creation to use "...filesystem/network policy and lifetime": add the field to the synthetic value or record the deferral in the port docstring (review #602 question 1).Explicitly not part of this correction: a durable grant journal or a broker↔journal transaction. That is future real-broker adapter scope already decided by the accepted documents; pulling it into issue #6 would be scope expansion and only then an owner decision.
Integration and merge remain owner-controlled; this assessment is not an approval.
PR Review: [K3] Prove synthetic execution, workspace and authority boundaries (#18)
Repository: Creatidy/creatidy-kernel
Branch: issue-6-synthetic-execution -> develop
Frozen head:
97ac966170(base059482d045; local checkout verified identical, clean tree, head unchanged before and after review)Linked issue: #6 (from PR body "Implements #6")
Reviewer context: fresh read-only session; no implementation-session context or verdict relied on. Review #602 covered head
3cf0b229and is stale for this head; this review independently covers the remediation commit97ac966("fix: bound synthetic workspace recovery and path scope", +47/−1) and re-verifies the whole diff. Forgejo rejects an APPROVED-state review from the samekiloaccount as the PR author, so this is posted as COMMENT; the verdict stands on its evidence and formal approval remains with a different account or the owner.Summary
Adds core execution/authority values,
ports/execution.py(Runtime,Workspace) andports/authority.py(AuthorityBroker) protocols, deterministicFakeRuntime/FakeWorkspace/FakeAuthorityBrokeradapters, three test modules, and honest README/threat-model updates. 11 files, +1115/−3; no dependency or tooling files touched. Dependency direction kept (adapters -> ports -> core, lint-imports KEPT); stdlib+pytest only.Remediation verification (
97ac966vs3cf0b22, against comment 11699 and review #602)src/creatidy_kernel/ports/authority.py:11.src/creatidy_kernel/ports/execution.py:31("Real adapters enforce workspace lifetime; the fake models only worker-scope expiry"). Field deliberately not added; code and ADR stay aligned via the docstring.fail_next_materialize(src/creatidy_kernel/adapters/fake_execution.py:37), lost-key semantics inmaterialize, andtests/test_fake_execution.py:161proving unknown-not-safe-to-replace.check_scopenow resolves root, target, and each allowed path, and requires allowed paths to resolve inside the root (src/creatidy_kernel/core/authority.py:88-96), with a new regression test proving a symlinked allowed path cannot widen the grant (tests/test_fake_authority.py:141). This also closes an escape the old comparison allowed (an allowed path that itself resolves outside the grant root).WORKER_OPERATIONSvocabulary in workspace access): not adopted; see non-blocking item 1.observenow raisesExecutionConflict,src/creatidy_kernel/adapters/fake_execution.py:171); see non-blocking item 2.Intent / Acceptance Evidence
ExecutionRequest.__post_init__binds attempt/workspace/context/allocation/agent-definition (src/creatidy_kernel/core/execution.py:188);FakeRuntime.publishvalidates scope attempt/workspace/fence/expiry/operation and binds candidate attempt/spec/artifacts (src/creatidy_kernel/adapters/fake_execution.py:190);issue/revokeowner-only (src/creatidy_kernel/adapters/fake_authority.py:22,33); candidate does not satisfy the WorkUnit — ownerFinishAttemptrequired, then READY (tests/test_k3_integration.py:141)identity_supported=Falseblanks resolved/observed (src/creatidy_kernel/adapters/fake_execution.py:143);reconcilerequires exactOperationKeyequality and optional exact handle, lost keys → UNKNOWN (src/creatidy_kernel/adapters/fake_execution.py:226); duplicatestartreturns same handle, changed inputs conflict; identical terminal replay no-op, changed candidate conflict (tests/test_fake_execution.py:38,57)fresh_until(WAITING at now=299, fresh_until=300, tests/test_fake_execution.py:98); reconcile keys on the exact effect key — a quiet false child stall cannot redirect recovery (tests/test_fake_execution.py:103)WORKER_OPERATIONS(src/creatidy_kernel/core/authority.py:51);accessdenies control-plane operations and path/symlink/network/mount escapes (src/creatidy_kernel/adapters/fake_execution.py:67-105); stalescope.fencepublish conflicts; journal rejects fence−1 (OperationConflict, tests/test_k3_integration.py:136); replay of a single-use grant rechecks revocation/expiry even when exact (src/creatidy_kernel/adapters/fake_authority.py:46)Runtime/Workspace(tests/test_fake_execution.py:83); reviewer-run lint-imports contract KEPT; stdlib+pytest only; uv.lock/pyproject unchangedISOLATEDfails closed withUnsupportedExecution(src/creatidy_kernel/adapters/fake_execution.py:38); docstrings and README/threat-model state trusted-development is not an OS/container boundaryAll six criteria are met with observable evidence.
Architecture / Information Flow
Conforms to
adapters -> ports -> coreand ADR 0004/0005 vocabulary. Start receives an immutable Attempt plus explicit workspace/context/allocation/capability references, Operation identity and fence; observe/cancel/candidate/reconcile distinguish FOUND/ABSENT/UNKNOWN; requested/resolved/observed identity recorded separately; single-use grants consumed inside one broker lock with exact replay returning the recorded intent without re-consuming, and no resurrection of consumed authority in the composition (the SQLite journal independently rejects stale fences). Per correction comment 11699: broker atomicity is in-memory only — correctly disclosed in code, PR body, and the port docstring; durable intent-bound consumption remains pinned to the real adapter. Integration uses the actual K2B signatures (admit_with_intent/claim/record_transport/observeverified againstsrc/creatidy_kernel/adapters/sqlite_store.py:349,521,564,585).Blocking Issues
None found.
Non-blocking Suggestions
FakeWorkspace.access(src/creatidy_kernel/adapters/fake_execution.py:84) still enforces a hardcoded control-plane denylist{"grant","accept","gate","control","credentials"}while core definesWORKER_OPERATIONSas the positive vocabulary. Checkingoperation in WORKER_OPERATIONSwould use one vocabulary and reject any name no grant can confer (carry-over from review #602, deliberately or not — fine to defer).candidate/progress/publish/cancel/losestill raiseKeyErroron unknown handles whereobservenow raisesExecutionConflict, andcore/execution.pymixes_textValueErrorwithExecutionConflict;progress's message "terminal activity cannot progress" also fires forfresh_for < 0.WorkerScope.__post_init__(src/creatidy_kernel/core/execution.py:186) validates only paths, notoperations ⊆ WORKER_OPERATIONS; a hand-built scope could carry arbitrary operation names pastaccess's first check unless denylisted. Synthetic-only concern — the real adapter derives scope from a grant — but a subset check would mirrorAuthorityGranthygiene.Questions for the Author
Security / Privacy Notes
Honest boundary labeling throughout: trusted-development mode documented as policy simulation,
ISOLATEDfails closed, control-plane operations unreachable through worker scope or grants, authentication explicitly trusted-channel, no secrets/network/live effects; secrets scan clean. The remediation's resolved-path comparison removes environment-dependent symlink behavior in scope checks and adds a genuine widening-attack regression test. Informational:AuthorityGrant.__post_init__performs live filesystem checks (root.is_dir()), acceptable for a synthetic simulation.Test / Documentation Gaps
Follow-Up Candidates
None durable enough for an issue; items 1–3 are ordinary polish belonging to the future real adapters or a passing cleanup.
Validation
Reviewer-run against the frozen head
97ac966170:uv run --locked pytest tests/test_fake_authority.py tests/test_fake_execution.py tests/test_k3_integration.py→ 12 passed;make check→ ruff format/check, basedpyright, lint-imports contract KEPT, 164 tests passed, secrets scan clean,git diff --checkclean;make package-check→ wheel/sdist rebuild and isolated install passed.make auditnot re-run by reviewer: the PR changes no dependency or tooling files, matching the validation rules' relevance condition; the PR reports it passed before the code-only remediation.Overall Recommendation
APPROVE — for the frozen head
97ac966170only. Integration and issue closure remain owner-controlled.PR Review: [K3] Prove synthetic execution, workspace and authority boundaries (#18)
Repository: Creatidy/creatidy-kernel
Branch: issue-6-synthetic-execution -> develop
Frozen head:
73be4bd608(base0fb435bf36; local clean checkout verified identical; head confirmed unchanged bygit ls-remotebefore and after this review)Linked issue: #6 (from PR body "Implements #6")
Reviewer context: fresh dispatched read-only reviewer session (Agent Manager local
ses_f2558af87ffe7rsTI143sc8bTq); no implementation-session context or verdict relied on. Reviews #602 (3cf0b229) and #603 (97ac966) cover prior heads and are superseded by this full review of the current head. Dispatch-resolution verification (DISPATCH_VERIFIED) belongs to the coordinating delivery session, not this reviewer. The PR body cites validation on97ac966; the head advanced to73be4bdby merging develop (0fb435b, governance PR #20). I verifiedgit diff 97ac966..73be4bdtouches only.kilo/command/deliver-issue.mdand.kilo/command/review-pr.md—src/,tests/, README and threat-model are byte-identical to the previously reviewed code; the branch is current with develop (merge-base equals base tip).Summary
Adds core execution/authority values,
ports/execution.py(Runtime,Workspace) andports/authority.py(AuthorityBroker) protocols, deterministicFakeRuntime/FakeWorkspace/FakeAuthorityBrokeradapters, three test modules (unit + K2B/K1 integration), and honest README/threat-model updates. 11 files, +1134/−3; no dependency or tooling files touched. Dependency direction kept (adapters -> ports -> core, lint-imports KEPT); stdlib+pytest only.Intent / Acceptance Evidence
ExecutionRequest.__post_init__binds attempt/workspace/context/allocation/agent-definition (src/creatidy_kernel/core/execution.py:145);FakeRuntime.publishvalidates scope attempt/workspace/fence/expiry/operation and binds candidate attempt/spec/artifacts (src/creatidy_kernel/adapters/fake_execution.py:190);issue/revokeowner-only (src/creatidy_kernel/adapters/fake_authority.py:20,29); candidate does not satisfy the WorkUnit — ownerFinishAttemptrequired, then READY (tests/test_k3_integration.py:147,150)identity_supported=Falseblanks resolved/observed (src/creatidy_kernel/adapters/fake_execution.py:143);reconcilerequires exactOperationKeyequality and optional exact handle; lost keys andrecoverable=False→ UNKNOWN (src/creatidy_kernel/adapters/fake_execution.py:226); duplicatestartreturns same handle, changed inputs conflict; identical terminal replay no-op, changed candidate conflict (tests/test_fake_execution.py:38,57)fresh_until(WAITING at now=299, fresh_until=300, tests/test_fake_execution.py:98); reconcile keys on the exact effect key with full Operation equality — a quiet false child stall cannot redirect recovery (tests/test_fake_execution.py:103)WORKER_OPERATIONS(src/creatidy_kernel/core/authority.py:50);accessdenies control-plane operations and path/symlink/network/mount escapes (src/creatidy_kernel/adapters/fake_execution.py:67-98); stalescope.fencepublish conflicts; journal rejects fence−1 (OperationConflict, tests/test_k3_integration.py:145); exact replay still rechecks revocation/expiry (src/creatidy_kernel/adapters/fake_authority.py:44)Runtime/Workspace(tests/test_fake_execution.py:40); reviewer-run lint-imports contract KEPT; stdlib+pytest only; uv.lock/pyproject unchangedISOLATEDfails closed withUnsupportedExecution(src/creatidy_kernel/adapters/fake_execution.py:43); README and threat-model state trusted-development is not an OS/container boundary for hostile codeAll six criteria are met with observable evidence.
Architecture / Information Flow
Conforms to
adapters -> ports -> coreand ADR 0004/0005 vocabulary. Start receives an immutable Attempt plus explicit workspace/context/allocation/capability references, Operation identity and fence; observe/cancel/candidate/reconcile distinguish FOUND/ABSENT/UNKNOWN; requested/resolved/observed identity recorded separately. Single-use grants are consumed inside one broker lock with exact replay returning the recorded intent without re-consuming, and exact replay rechecks revocation/expiry (ADR 0005); the in-memory-only scope of that atomicity is honestly disclosed in code, PR body, and the port docstring (src/creatidy_kernel/ports/authority.py:11), with durable intent-bound consumption pinned to the real adapter. The K2B integration uses the actual signatures (admit_with_intent/claim/record_transport/observeverified against src/creatidy_kernel/adapters/sqlite_store.py:349,521,564,585, including the accepted-reference binding and no-regress rules the test relies on). ADR 0004 workspace-lifetime deferral is documented at src/creatidy_kernel/ports/execution.py:31.Blocking Issues
None found.
Non-blocking Suggestions
Unchanged code from the previously reviewed head; carry-over polish items remain accurate:
FakeWorkspace.access(src/creatidy_kernel/adapters/fake_execution.py:84) enforces a hardcoded control-plane denylist while core definesWORKER_OPERATIONSas the positive vocabulary. Checkingoperation in WORKER_OPERATIONSwould use one vocabulary and reject any name no grant can confer.candidate/progress/publish/cancel/loseraiseKeyErroron unknown handles whereobserveraisesExecutionConflict;core/execution.pymixes_textValueErrorwithExecutionConflict;progress's "terminal activity cannot progress" also fires forfresh_for < 0.WorkerScope.__post_init__(src/creatidy_kernel/core/execution.py:188) validates only paths, notoperations ⊆ WORKER_OPERATIONS; a hand-built scope could carry arbitrary operation names pastaccess's first check unless denylisted. Synthetic-only concern — real adapters derive scope from a grant.Questions for the Author
97ac966while the head is the merge commit73be4bd(code identical, develop governance docs merged in). Please note the merge in the delivery ledger so the HEAD trail is self-explanatory for the next session.Security / Privacy Notes
Honest boundary labeling throughout: trusted-development mode documented as policy simulation,
ISOLATEDfails closed, control-plane operations unreachable through worker scope or grants, authentication explicitly trusted-channel, no secrets/network/live effects; reviewer-run secrets scan clean. The resolved-path scope comparison (src/creatidy_kernel/core/authority.py:88-96) is environment-independent and the symlink-widening regression test holds. Informational:AuthorityGrant.__post_init__performs live filesystem checks (root.is_dir()), acceptable for a synthetic simulation.Test / Documentation Gaps
Follow-Up Candidates
None durable enough for an issue; items 1–3 are ordinary polish belonging to the future real adapters or a passing cleanup.
Validation
Reviewer-run against the frozen head
73be4bd608: focused testsuv run --locked pytest tests/test_fake_authority.py tests/test_fake_execution.py tests/test_k3_integration.py→ 12 passed;make check→ ruff format/check, basedpyright, lint-imports contract KEPT, 164 tests passed, secrets scan clean,git diff --checkclean;make package-check→ wheel/sdist rebuild and isolated install passed.make auditnot re-run by reviewer: the PR changes no dependency or tooling files, matching the validation rules' relevance condition.Overall Recommendation
APPROVE — for the frozen head
73be4bd608only. Integration and issue closure remain owner-controlled.