Conversation
The rewrite needs an executable ledger for every mounted transport and lifespan responsibility before target ownership work can begin. Static AST discovery avoids importing the legacy application, while hashed evidence, legal transitions, owner-contract checks, isolated reference validation, and guarded whole-worktree release keep the old surface auditable through final disposition. Constraint: The immutable legacy reference remains fixed at 8ed4ae2 and uses persistence resources distinct from the target. Rejected: Import the FastAPI application to build coverage | module import can execute configuration and hides whether a route is statically mounted. Confidence: high Scope-risk: moderate Directive: Do not prune reviewed coverage rows or release the reference until every row is terminal and its recorded checkout passes HEAD, cleanliness, content-hash, and isolation checks. Tested: uv run --extra dev pytest tests/architecture/test_rewrite_inventory.py (13 passed); uv run --extra dev ruff check scripts/rewrite_inventory.py tests/architecture/test_rewrite_inventory.py; runtime/static mounted-route comparison (373 exact); build/check commands (401 entries). Not-tested: Live immutable-reference boot and black-box fixtures require the separately provisioned checkout and isolated persistence environment; destructive worktree release was intentionally not executed.
Record the accepted clean-rewrite boundary before implementation so Backend stabilization, retained application logic, UI foundation ownership, and browser acceptance cannot drift into an incremental compatibility migration. Constraint: Keep valid React, routing, state, icon, chart, and business-contract owners while replacing the generic presentation system Rejected: Preserve old generic component APIs through adapters | creates a dual UI system with no clean removal boundary Confidence: high Scope-risk: narrow Reversibility: clean Directive: Do not implement legacy generic UI adapters or treat Backend and build checks as Frontend browser acceptance Tested: Agent Note format, relative links, Prettier formatting, and Git whitespace checks Not-tested: UI implementation, browser behavior, accessibility, visuals, and performance because this commit records a proposal only
Add executable positive and negative fixtures for module ownership, migration topology, ledger authority, and startup prohibitions without treating the legacy tree as target-runtime proof. Constraint: Target app/modules and app/runtime are not implemented yet Confidence: high Scope-risk: narrow Directive: Point the fixture validators at target modules when their owners begin implementation Tested: uv run --extra dev pytest tests/architecture/test_module_boundaries.py tests/architecture/test_governance.py -q; uv run --extra dev ruff check tests/architecture/test_module_boundaries.py tests/architecture/test_governance.py Not-tested: Target runtime behavior and PostgreSQL schema waves
Coverage transitions previously read a fabricated entries array and could approve dispositions for unknown owners. Reusing the owner ledger validator makes the owner roster, approval state, contract artifact hash, and evidence rules one shared authority for both disposition and contract transitions. Constraint: Coverage rows use backend/rewrite/owner-contracts.json with the canonical version/owners schema and exact roster. Rejected: Duplicate a reduced owner schema in rewrite_inventory.py | it would drift from the authoritative owner-contract checker again. Confidence: high Scope-risk: narrow Directive: Keep coverage owner validation delegated to check_owner_contracts; do not introduce a second owner-ledger parser. Tested: uv run --extra dev pytest tests/architecture/test_rewrite_inventory.py (20 passed); uv run --extra dev ruff check scripts/rewrite_inventory.py tests/architecture/test_rewrite_inventory.py; real coverage disposition gate unreviewed=0 disposition_missing=0. Not-tested: A real owner contract is not yet approved in the canonical ledger, so the production ledger was exercised through an isolated canonical-roster copy with hashed contract and evidence artifacts.
Declare the local-container service topology and exact synthetic payload sizes required by the approved Phase 0 qualification. The capacity Note now separates frozen benchmark inputs from tunable runtime configuration and unresolved Frontend qualification. Constraint: Payload sizes are benchmark fixtures and must not imply product or storage limits Rejected: Leave payloads implicit | results from different request and result sizes would appear comparable Confidence: high Scope-risk: narrow Directive: Do not change backend_50 inputs without an approved reference-profile revision and matching contract tests Tested: uv run --extra dev pytest tests/performance/test_load_profile_validation.py -q (27 passed) Tested: uv run python scripts/validate_load_profile.py tests/performance/profiles/backend_50.json Tested: uv run --extra dev ruff check scripts/validate_load_profile.py tests/performance/test_load_profile_validation.py
Bind every approved S3 owner row to the matching complete product contract so arbitrary architecture artifacts cannot authorize deferred product implementation. Constraint: Product completeness remains owned by check_product_contracts.py while the owner ledger owns readiness Rejected: Duplicate product-field validation in the owner checker | it would create a second product contract authority Confidence: high Scope-risk: narrow Directive: S3 owner artifacts and evidence must remain identical to their approved product contract entry Tested: 32 focused owner/product architecture tests; Ruff and formatting checks on changed Python files Not-tested: No canonical S3 product contract is approved yet
Classify all mounted endpoint and lifecycle rows from the accepted source-disposition Note and coverage matrix. Record deterministic Backend behavior locations, Frontend or external consumer evidence, exact target owners or deletion intent, and planned gates before advancing only the Phase 0 disposition state. Constraint: Target implementation remains blocked until all 401 frozen rows have approved dispositions. Rejected: Infer missing product behavior from route names alone | decisions are bounded by committed architecture artifacts and current source evidence. Confidence: high Scope-risk: moderate Reversibility: clean Directive: Do not advance these rows beyond disposition_approved until matching owner contracts and target evidence exist. Tested: canonical coverage gate; immutable reference check with isolated namespaces and boot smoke; 23 focused architecture tests; scoped Ruff Not-tested: live database, Redis, or external consumer traffic
The clean-break target now boots through one FastAPI factory and owns one SQLAlchemy metadata registry. Its application lifespan creates separate control and execution pools, exposes only the minimal health route, and awaits deterministic disposal without retaining the old configuration or database entry points. Constraint: The qualification profile requires isolated control and execution pools of 20 connections each. Constraint: Target startup cannot import legacy APIs, models, services, lifecycle work, or schema mutation. Rejected: Keep app.config and app.database forwarding modules | compatibility aliases would preserve the old import authority. Rejected: Share one engine across control and execution | one pool cannot enforce the accepted role capacity boundary. Confidence: high Scope-risk: broad Reversibility: clean Directive: Keep application resources owned by app.application lifespan and keep the sole Base in app.infrastructure.database. Tested: 105 backend architecture tests; scoped Ruff; scoped Pyright; staged diff check. Not-tested: Legacy full-suite execution; old tests still import the intentionally removed app.config and app.database modules.
The target modular monolith needs one importable package per canonical owner before schema and service work begins. The architecture guard reads the owner-contract ledger directly so the roster and its wave/phase mapping remain single-sourced. Constraint: owner-contracts.json remains the sole owner roster and wave/phase authority Constraint: This G002 commit contains no Runtime, composition, infrastructure, or owner implementation changes Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep owner package markers empty until the owning contract authorizes implementation Tested: uv run --extra dev pytest tests/architecture/test_owner_package_skeleton.py (4 passed) Tested: uv run --extra dev ruff check app/modules tests/architecture/test_owner_package_skeleton.py (passed) Tested: uv run --extra dev pyright app/modules (0 errors, 0 warnings)
Database configuration now retains its DSN as a Pydantic secret through validation and application ownership. Invalid values hide their inputs, settings representations stay masked, and the raw URL is revealed only to SQLAlchemy at engine construction. Constraint: Invalid target configuration must fail without disclosing credential material. Rejected: Keep DATABASE_URL as str and redact selected messages | repr and model dumps would remain accidental disclosure paths. Confidence: high Scope-risk: narrow Reversibility: clean Directive: Do not call get_secret_value outside the database engine construction boundary. Tested: 114 backend architecture tests; scoped Ruff; scoped Pyright; staged diff check. Not-tested: Live PostgreSQL connection establishment; engine construction receives the validated raw DSN under a focused test.
The modular skeleton is still empty, so architecture drift must be rejected before owner slices add code. AST-based guards resolve absolute and relative imports plus imported and assigned aliases, while reading owner identities from the canonical owner-contract ledger. Constraint: Runtime may contain only Run-owned Runner and Loop mechanics. Constraint: Target packages cannot import legacy authorities or another owner's private persistence. Rejected: Duplicate the owner roster in test constants | it would create a second authority that can drift from the ledger. Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep public typed owner contracts permitted; extend fixtures whenever a new import spelling or registry constructor is supported. Tested: Phase 1 guard 70 passed; focused boundary suite 60 passed; scoped Ruff passed; Pyright 0 errors; git diff check passed. Not-tested: Full Backend Ruff remains blocked by 2859 pre-existing legacy-tree violations.
The final target composition already owns application and database lifecycle, so the old LangGraph Runtime, Checkpoint, Command, generic Runtime Event, Tool Ledger, and Session Context execution authority must no longer remain importable on develop. Delete the complete tracked agent_runtime package, its five dedicated execution persistence models, checkpoint setup script, and tests that exist only to preserve those contracts. The exact commit name-status manifest contains 60 Runtime source paths, 5 models, 1 setup script, and 64 authority-only tests. Keep product APIs, services, migrations, dependencies, and their dangling legacy imports for separate owner/category deletion commits. Constraint: Clean-break target forbids compatibility wrappers, dual authority, and mixed deletion categories Rejected: Repair dangling legacy product imports here | violates the minimum-commit boundary and would mix later owner deletions into Runtime authority removal Confidence: high Scope-risk: broad Reversibility: clean Directive: Do not restore app.services.agent_runtime or the deleted execution models; rewrite surviving consumers only through their approved target owners Tested: Phase 1 architecture gate 70 passed; scoped target Ruff passed; scoped target Pyright 0 errors; target forbidden-import search 0; git diff --check passed Not-tested: Full legacy-tree Ruff has 2397 pre-existing errors; full app Pyright has 245 staged-tree errors; collect-only has 270 tests and 123 expected errors pending later deletion commits
The target composition must fail through its own configuration and schema boundaries without an entrypoint that upgrades the legacy database, installs checkpoints, repairs mounted state, or revives API/worker process roles. Alembic now reads only the target infrastructure registry while the unreleased target branch retains the old revision graph solely until the serialized G008 baseline cutover. Constraint: Keep every existing migration revision and the current single head untouched until G008 Constraint: Run the target ASGI application in exactly one Uvicorn worker Rejected: Preserve START_COMMAND or APP_WORKERS overrides | either can restore multiple execution owners Confidence: high Scope-risk: moderate Reversibility: clean Directive: Apply migrations outside application startup; do not treat the retained legacy head as the target baseline Tested: Phase 1 architecture and startup boundary 86 passed; scoped Ruff passed; scoped Pyright 0 errors; bash -n passed; Alembic reports one head f065_feishu_group_target; forbidden-source searches and git diff check passed Not-tested: Full staged legacy-tree Ruff and Pyright remain failing pending later deletion commits; Docker and Helm topology remain outside this commit and the target baseline is not implemented
A denylist could only reject command spellings already anticipated and allowed alternate repair paths such as psql file execution. The architecture guard now accepts only direct single-worker startup or the exact privilege-drop wrapper, while the legacy schema/checkpoint test is removed because its assertions preserve deleted authority. Constraint: Keep production startup, deployment topology, and migration revisions unchanged in this review fix Rejected: Expand the forbidden-token list | alternate shells, wrappers, variables, and command forms would remain open-ended bypasses Confidence: high Scope-risk: narrow Reversibility: clean Directive: Any new entrypoint executable step requires an explicit architecture decision and positive/negative guard update Tested: Phase 1 architecture and startup boundary 99 passed; focused Ruff passed; focused Pyright 0 errors; bash -n passed; Alembic reports one head f065_feishu_group_target; git diff check passed Not-tested: Deployment environment and PATH integrity remain deferred to the deployment topology gate; no migration revision or target baseline changed
The clean-break target must source Context only from the approved target contract, so the implicit prompt, relationship, setting, Skill-index, and fallback assembly module cannot remain importable. Delete that module and its authority-only tests, then guard the complete Python import identity against reintroduction as either a module file or a same-named package directory. Constraint: Model and Experience authority deletion remain separate minimum commits Rejected: Guard only agent_context.py | Python can resolve the same authority from an agent_context package directory Confidence: high Scope-risk: narrow Reversibility: clean Directive: Do not recreate app.services.agent_context as a module or package; target Context must be implemented only after its owner contract is approved Tested: Deleted-authority guard 3 passed; Phase 1 architecture suite 193 passed; scoped target Ruff passed; scoped target Pyright 0 errors; git diff --check passed Not-tested: Remaining Model and Experience paths are intentionally left for separate minimum commits
The accepted clean break removes the Experience library, revision drafts, citation projection, and retrieval/RAG path rather than carrying them into target Workspace or Context ownership. Delete the old transport, persistence, retrieval service, and authority-only tests, then guard each former Python import identity against reintroduction as either a module file or a same-named package directory. Constraint: Model and LLM authority deletion remains a separate minimum commit Rejected: Guard only the four deleted .py files | Python can resolve the same authorities from package directories Confidence: high Scope-risk: narrow Reversibility: clean Directive: Do not restore the experience API, models, or retrieval service as modules or packages; future retrieved content requires an approved target owner Tested: Deleted-authority guard 12 passed; Phase 1 architecture suite 202 passed; scoped target Ruff passed; scoped target Pyright 0 errors; git diff --check passed Not-tested: Remaining Model/LLM paths and surviving Experience callers belong to later minimum commits
The clean-break target cannot retain the old LLM ORM, Model resolution and failover, monolithic caller, finish protocol, single-step loop, or Provider request package while the target Model owner remains contract-gated. Delete the complete old package and its authority-only tests, then guard both former Python import identities against reintroduction as module files or package directories. Constraint: The immutable legacy checkout is black-box evidence only; reusable Provider functions may be recovered only from Git history and independently reviewed Rejected: Guard individual services.llm source files | restoring the package under a new file layout would recreate the same Python authority identity Confidence: high Scope-risk: broad Reversibility: clean Directive: Do not restore app.models.llm or app.services.llm as modules or packages; target Provider code must be recovered function-by-function from Git history behind the approved Model owner Tested: Deleted-authority guard 17 passed; Phase 1 architecture suite 207 passed; scoped target Ruff passed; scoped target Pyright 0 errors; categorized collect-only recorded 275 tests and 111 expected legacy-category errors; git diff --check passed Not-tested: Surviving product callers remain staged for their own owner or deletion-category commits
The accepted target represents delegated work through Task Tool calls and Child Runs, so the old Task and TaskLog ORM lifecycle, CRUD transport, and Runtime intake service cannot remain importable. Delete the complete authority and its dedicated tests, then guard all three former Python identities against module-file and package-directory reintroduction. Constraint: Preserve surviving Tool, Agent, metrics, bootstrap, schema, migration, and Frontend callers as staged evidence for their own minimum commits; do not add compatibility imports or repair dangling consumers here Rejected: Retain the old Task API as a Task Tool adapter | it would preserve Task and TaskLog as a second lifecycle authority Confidence: high Scope-risk: moderate Reversibility: clean Directive: Do not restore app.models.task, app.api.tasks, or app.services.task_executor; target Task Tool must be implemented through the approved Run and Tool contracts Tested: Deleted-authority guard 24 passed; Phase 1 architecture suite 214 passed; scoped Ruff passed; scoped Pyright 0 errors; categorized collect-only recorded 282 tests and 109 expected staged clean-break errors; git diff --check passed Not-tested: Surviving legacy consumers remain intentionally dangling for later owner or deletion-category commits
The clean-break target must not retain the Tool and AgentTool ORM, management API, builtin definition catalog, configuration and seeding paths, or the monolithic agent_tools exposure and dispatch facade. Delete that complete owner boundary and every approved legacy test coupled to it, preserve only the independent MCPClient transport test, and guard every former import identity as both module and package. Constraint: The user explicitly requires deletion of mixed legacy Tool tests, including direct retained-helper assertions; future MCP, Feishu, Sandbox, AgentBay, Trigger, and Workspace owners must write fresh target-contract tests Constraint: Preserve implementation candidates and use immutable Git history only for later function-by-function salvage Rejected: Extract, move, or adapt old tests during deletion | that would carry old Tool authority assumptions into future owners Confidence: high Scope-risk: broad Reversibility: clean Directive: Do not restore the deleted import identities or tests; implement target Tool and retained helper coverage only through approved target owners and new contracts Tested: Deleted-authority guard 39 passed; Phase 1 architecture suite 229 passed; preserved MCP transport test 1 passed; scoped Ruff passed; scoped Pyright 0 errors; categorized collect-only recorded 298 tests and 66 expected staged clean-break errors; all 42 deleted test files directly referenced old Tool authority; git diff --check passed Not-tested: Twelve surviving application import sites and one Approval-category test string remain intentionally dangling for later minimum commits
The clean-break target must not retain the Skill ORM, database-backed API and import facade, default seeder, or Agent-authored creator and evaluation assets. Delete that authority and its dedicated legacy tests, keep independent Workspace, storage, MCP, discovery, provider, Channel, migration, and dependency surfaces staged for their own owners, and guard every former import identity plus the generated creator-files path. Constraint: The user requires all old Skill tests to be deleted and fresh target-contract tests to be written later by Workspace and Capability Market owners Constraint: Mixed files.py Skill routes and other dangling consumers remain for later minimum owner/category commits Rejected: Move or adapt the old tests during deletion | that would preserve the retired Skill DB/API/seeding contracts Confidence: high Scope-risk: moderate Reversibility: clean Directive: Do not restore the deleted Skill identities, creator assets, or tests; implement controlled installation and Workspace Skill packages only through approved target owners and new contracts Tested: Deleted-authority guard 49 passed; Phase 1 architecture suite 239 passed; scoped Ruff passed; scoped Pyright 0 errors; categorized collect-only recorded 308 tests and 64 expected staged clean-break errors; git diff --check passed Not-tested: Seven surviving direct import sites in five mixed or later-category files remain intentionally dangling
The clean-break target has one shared Agent Runner and cannot retain remote OpenClaw polling, queued Gateway messages, API-key delivery, container lifecycle, or the combined legacy Agent manager. Delete those import identities and their dedicated tests, require fresh target-owner tests later, and guard every identity as both a module and package. Constraint: The user requires all legacy OpenClaw/Gateway behavior and tests to be deleted without forward compatibility Constraint: Agent, Workspace, Session, A2A, and Channel owners must write fresh tests from approved target contracts Rejected: Extract Soul and workspace initialization from agent_manager during this commit | that would mix target owner implementation into an authority-deletion commit Confidence: high Scope-risk: moderate Reversibility: clean Directive: Do not restore app.api.gateway, app.models.gateway_message, or app.services.agent_manager; delete the documented mixed residuals with their owning categories Tested: Deleted-authority guard 56 passed; Phase 1 architecture suite 246 passed; scoped Ruff passed; scoped Pyright 0 errors; categorized collect-only recorded 312 tests and 63 expected staged clean-break errors; git diff --check passed Not-tested: Eight files still directly import deleted identities and nine non-guard Python files retain OpenClaw or gateway_message residue for later owner-category commits
The clean-break target will implement one Tenant-scoped Credential and Secret owner from its approved contract. Delete the Agent-scoped cookie ORM, DAO, CRUD API, transport schemas, and compatibility export instead of preserving their persistence or API shapes. Guard every removed import identity as both a module and package, and require fresh target Credential tests later. Constraint: The user requires all legacy Credential behavior and tests to be deleted without forward compatibility Constraint: Channel configuration, identity-provider, Agent, Tool/MCP, Atlassian, Provider, AgentBay, and mixed Secret consumers remain for their own owner-category commits Rejected: Adapt the old cookie CRUD tests into target Credential tests | G003 must derive new tests from the approved Credential contract Confidence: high Scope-risk: moderate Reversibility: clean Directive: Do not restore app.api.agent_credentials, app.dao.agent_credential_dao, app.models.agent_credential, or app.schemas.agent_credential; remove documented residual consumers with their owning categories Tested: Deleted-authority guard 65 passed; Phase 1 architecture suite 255 passed; scoped Ruff passed; scoped Pyright 0 errors; categorized collect-only recorded 321 tests and 63 expected staged clean-break errors; git diff --check passed Not-tested: AgentBay control and cookie injection still import the deleted model; Tenant cleanup and legacy Alembic revisions still name the old table pending their owner-category and target-baseline commits
Deleting the legacy DAO module did not by itself prevent app.dao from recreating the old package-level symbol. Parse the DAO package initializer and reject the retired symbol through imports, aliases, assignments, attributes, __all__, globals mutation, and module-level __getattr__ hooks. Constraint: This review fix changes only the deleted-authority architecture guard Rejected: Import app.dao and inspect it at runtime | staged clean-break imports intentionally fail before remaining legacy categories are removed Confidence: high Scope-risk: narrow Reversibility: clean Directive: Do not expose agent_credential_dao from app.dao through static or dynamic package namespace behavior Tested: Deleted-authority guard 73 passed; Phase 1 architecture suite 263 passed; scoped Ruff passed; scoped Pyright 0 errors; git diff --check passed Not-tested: Full Backend collection remains intentionally broken by staged clean-break deletions outside this guard-only fix
Make the direct SSO-to-Credential dependency explicit in the canonical owner DAG and enforce its ordering and approval before any SSO contract can authorize implementation. Constraint: Owner-contract rows keep the approved schema; dependency authority remains owner-dag.json Rejected: Copy depends_on into owner-contracts.json | it would duplicate the DAG authority Confidence: high Scope-risk: narrow Directive: Do not remove the direct SSO Credential dependency even though other paths may be transitively related Tested: Canonical owner build/check; 35 focused owner/product tests; Ruff and formatting checks Not-tested: SSO product contract remains intentionally unapproved
The clean-break target separates Agent identity, Permission, Agent Template, and Onboarding ownership, so the old aggregate model, CRUD/API lifecycle, access DAOs, default seeder, package exports, and authority-only tests cannot remain. Delete those identities without adapting their contracts and guard module, package, static-export, and dynamic-export restoration paths. Constraint: The user requires all old Agent aggregate behavior and tests to be deleted without forward compatibility Constraint: Directory, Metrics, Agent Template DAO, advanced routes, Onboarding, storage agent_files, mixed schemas, migrations, Frontend, and target modules remain for separate owner commits Rejected: Extract AgentPermission, AgentTemplate, or AgentUserOnboarding during deletion | their approved target owners must implement fresh contracts and tests Confidence: high Scope-risk: broad Reversibility: clean Directive: Do not restore app.models.agent, app.api.agents, app.dao.agent_dao, app.dao.agent_access_dao, app.services.agent_seeder, or their app.dao exports Tested: Deleted-authority guard 92 passed; scoped Ruff passed; scoped Pyright 0 errors; categorized collect-only recorded 351 tests and 59 expected staged clean-break errors; git diff --check passed Not-tested: Phase 1 architecture suite has 277 passed and 8 pre-existing Owner DAG/fixture failures on current HEAD; 65 direct application consumers remain intentionally dangling for later owner-category commits
Update architecture expectations for the direct SSO Credential dependency and make temporary owner ledgers include the canonical DAG required by the production validator. Constraint: Production owner and coverage checkers remain unchanged Rejected: Relax missing-DAG validation in tests | it would hide an incomplete canonical fixture Confidence: high Scope-risk: narrow Directive: Owner-contract fixtures must write owner-dag.json beside the ledger before exercising coverage transitions Tested: 285 architecture tests; 78 focused governance/coverage/owner tests; Ruff and Pyright on changed tests Not-tested: Ruff formatter baseline remains unchanged because formatting the whole legacy test file would broaden the diff
The clean-break target replaces global Identity, tenant User membership, Tenant configuration, sparse Tenant settings, CRUD transports, and direct DAOs with one newly contracted identity_tenant owner. Delete the old authority and its Tenant-only schema assertions without adapting behavior, then guard every import identity and package-export restoration path. Constraint: The user requires old Identity/Tenant behavior and tests to be deleted without forward compatibility Constraint: Auth, SSO, identity providers, Organization, Invitation, Onboarding, Permission, AgentBay, Channel, Enterprise, Platform Administration, mixed schemas, migrations, dependencies, and Frontend remain for separate owner commits Rejected: Repair the 60 dangling application consumers in this deletion | each belongs to a later owner or category and compatibility wiring would recreate the retired authority Confidence: high Scope-risk: broad Reversibility: clean Directive: Do not restore app.models.user, app.models.tenant, app.models.tenant_setting, app.api.users, app.api.tenants, the three deleted DAOs, or their app.dao exports Tested: Deleted-authority guard 117 passed; Phase 1 architecture suite 310 passed; scoped Ruff passed; scoped Pyright 0 errors; full app Pyright recorded 425 expected staged errors; collect-only recorded 376 tests and 59 expected staged errors; git diff --check passed Not-tested: Legacy application runtime remains intentionally unassembled; 60 direct application consumers and retained migrations, schemas, dependencies, and Frontend remain staged for later commits
The clean-break target replaces password login and registration, account binding, token issuance, reset and verification lifecycles, SSO callback orchestration, and Provider construction with a newly contracted Auth owner. Delete the old API and orchestration services without adapting their behavior, preserve independently owned SSO, IdentityProvider, Google Workspace, system-email, notification, and shared security boundaries, and guard every deleted import identity and package-export restoration path. Constraint: The user requires old Auth behavior and tests to be deleted, with fresh target Auth tests written only after the replacement contract is implemented Constraint: SSO API and service, SSO session security, IdentityProvider lookup, Google Workspace, Organization, Invitation, Onboarding, generic email transport, core security, mixed schemas, migrations, dependencies, and Frontend remain for separate owner commits Rejected: Delete app.core.security with the old Auth authority | retained APIs, WebSockets, SSO, encryption, Sandbox, and provider boundaries still consume its shared JWT, authorization, and encryption helpers Rejected: Repair the 14 retained production files and test_sso_toggle.py that import deleted Auth identities | each belongs to a later owner or category and compatibility wiring would recreate the retired authority Confidence: high Scope-risk: broad Reversibility: clean Directive: Do not restore app.api.auth, the five deleted Auth orchestration services, their package exports, or legacy Auth tests Tested: Deleted-authority guard 137 passed; Phase 1 architecture suite 330 passed; scoped Ruff passed; scoped Pyright 0 errors; full app Pyright recorded 426 expected staged errors; collect-only recorded 396 tests and 58 expected staged errors; git diff --check passed Not-tested: Legacy application runtime remains intentionally unassembled; 14 retained production files and test_sso_toggle.py remain staged dangling consumers for later owner-category commits
The Auth deletion removed a mixed test file that also held SSO browser-binding coverage, while test_sso_toggle still depended on the deleted Auth API and its test helpers. Restore the two SSO status checks from Git history under an SSO-owned test file, remove the Auth-owned tenant-switch assertion, localize the remaining platform SSO fixtures, and reject deleted Auth imports anywhere in ordinary Backend tests. Constraint: SSO production code and the deleted Auth API and services must remain unchanged Constraint: The clean-break tree still lacks app.database and the old Identity/Tenant API, so focused SSO ownership tests remain staged until their retained owners are collectable Rejected: Restore test_auth helpers or app.api.auth for test compatibility | that would recreate deleted Auth authority and defeat the import guard Rejected: Drop the browser-binding tests with the mixed Auth suite | browser binding belongs to surviving SSO session security Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep SSO session-security tests independent of deleted Auth imports and test helpers Tested: Deleted-authority guard 142 passed; Phase 1 architecture suite 335 passed; scoped Ruff passed; scoped Pyright 0 errors; collect-only recorded 401 tests and 59 expected staged errors; git diff --check passed Not-tested: Focused SSO browser-binding and platform-toggle tests cannot collect until the staged app.database and Identity/Tenant owner gaps are resolved
The ordinary-test guard covered deleted Auth module identities but missed package-level singleton exports whose dotted name differs from the deleted module, including auth_provider_registry. Build the forbidden dotted identities from both deleted modules and package exports, then prove aliased ImportFrom usage is rejected. Constraint: This follow-up is guard-only and must not change production code, test ownership, or the source-disposition Note Rejected: Special-case auth_provider_registry in the AST scanner | deriving all package exports from the existing authority map keeps equivalent ImportFrom forms covered Confidence: high Scope-risk: narrow Reversibility: clean Directive: Add every deleted Auth package export to LEGACY_AUTH_PACKAGE_EXPORTS so ordinary-test imports remain closed Tested: Deleted-authority guard 143 passed; Phase 1 architecture suite 336 passed; scoped Ruff passed; scoped Pyright 0 errors; git diff --check passed Not-tested: Full Backend collection remains outside this guard-only follow-up and retains the previously recorded staged clean-break errors
Normalize ZoneInfo path validation failures at the Agent boundary on both creation and update without exposing the supplied path. Confidence: high Scope-risk: narrow Tested: Agent service tests, 8 passed including three invalid path cases Not-tested: Product HTTP error rendering
…lures Pin the initial input outside compaction, order late input after the exchange that did not observe it, and settle interruption with the product consumer. Retry only fixed transient Model requests within the confirmed three-attempt policy, preserving Tool effects and original media History. Constraint: No resumable provider-pause state, fallback model, or Tool replay Confidence: high Scope-risk: moderate Directive: Input consumption remains the successful Model read boundary, never the Context cursor Tested: Engine suite, 84 passed; independent lifecycle review targets, 33 passed; cross-layer review Not-tested: Live Providers, G006 product input transport, formal platform load
…rvices Bind Model token counting and summary retry preparation into the application and retain fixed-cardinality Context observations. Verify actual member and MCP image execution through real services and PostgreSQL, isolating only external HTTP and the G006 product owner fixture. Confidence: high Scope-risk: moderate Tested: Three application E2E cases; Context statistics tests, 2 passed; Model and media path, 175 passed Not-tested: Live Provider and MCP endpoints, G006 product routes, 50-Agent qualification Directive: Fixture product completion is not evidence of Session API implementation
…r product APIs Separate G005 core evidence from G006 routes while retaining reference environment, actual concurrency and workload requirements. Verify physical cleanup separately from committed admission release so fairness checks do not confuse asynchronous termination with a leak. Confidence: high Scope-risk: narrow Tested: Qualification policy cases, 81 passed and one long test skipped; one-slot and 50-slot fairness cases passed; independent qualification review Not-tested: New reference-environment long load; slow and CPU workload measurements remain missing Directive: Historical diagnostics remain not qualified and synthetic policy fixtures are not performance evidence
…alification Separate clean-export core coverage from the full working-tree regression and retain the deferred reference-load and product-entry evidence gaps. Confidence: high Scope-risk: narrow Tested: Clean export 26c792f, 540 passed; full working tree, 2910 passed and one skipped; Ruff, Pyright, architecture and governance checks passed Not-tested: Reference-environment long load, slow and CPU workload measurements, hosted Provider and G006 product entry
…ring Replace the stale pending-Runner statement and point Model-specific evidence to the existing application media fixture. Preserve hosted Provider, product API and formal performance gaps. Scope-risk: narrow Tested: Documentation diff and existing evidence links checked Not-tested: No code change or new runtime test
Append a Workspace-only contract amendment that retains the frozen G004 baseline and narrows its distillation exception. Record the independent review and connect current Workspace guidance to the new binding. Constraint: Preserve prior contracts, receipts and other owner bindings Confidence: high Scope-risk: narrow Tested: Owner and goal governance tests, 103 passed; both manifest checks passed; independent architecture review Not-tested: No business code changes or new runtime tests Directive: Performance driver changes remain outside this user-authorized scope
Record the confirmed conversational work-control design, Main-only message outlet, atomic Need Input question and wait relation, fixed human login expiry, and stopping Goal after execution failure. Define the first Session transaction boundaries without declaring them implemented. Confidence: high Scope-risk: moderate Constraint: Human login does not determine Agent execution lifetime Rejected: New Goal iterations after retry exhaustion | defeats bounded retries Tested: Independent implementation preflight, documentation diff, owner and goal manifest validation Not-tested: G006 product implementation, HTTP/WebSocket and full product acceptance Directive: Bind reviewed Session and Run service amendments before implementing the new transactional ports
Derive the attempt limit from one delay tuple consumed by both preparation and execution. Preserve the initial three attempts and existing backoff without adding model-selected settings or another configuration table. Confidence: high Scope-risk: narrow Tested: Retry-focused Engine and policy tests, 24 passed; Ruff and Pyright passed; independent code review Not-tested: G006 Session integration and live Provider retries
Approve G006 transactional start and wait consumers, independent message acceptance, fixed human login expiry, and product-owned execution and delivery. Preserve all prior approval receipts and the separate later Auth product scope. Confidence: high Scope-risk: moderate Tested: Independent code and architecture preflight; owner and goal manifest validation Not-tested: G006 implementation and product acceptance remain pending Directive: Stop at G006; do not interpret contract approval as runtime or load acceptance
Let product transports consume validated authorization and its persisted expiry through Auth. Keep Principal-only authentication and existing Run lifetimes unchanged. Confidence: high Scope-risk: narrow Tested: Auth service tests, 5 passed; independent Auth boundary review Not-tested: WebSocket expiry and full product integration
…cution Validate human account selections through existing Agent and Tool capture policy. Reject unavailable selected tools instead of falling back or omitting the account. Product owners receive a versioned selection codec without acquiring Secret access. Constraint: Personal credentials remain Membership-owned and target-Agent scoped Rejected: Omit disabled selected tools | changes the explicit account choice silently Confidence: high Scope-risk: moderate Tested: Isolated staged export Tool service and selection PostgreSQL tests, 21 passed; independent code and architecture review Not-tested: Product HTTP intake is a later G006 integration slice
…ettlement Expose transactional Main startup and Waiting consumers so product records cannot lag execution. Reuse family locks for Tool origin checks and terminal settlement; late results never replay a cancelled operation. Constraint: Run remains the only lifecycle owner; Child execution has no direct product message outlet Confidence: high Scope-risk: moderate Tested: Isolated staged export lifecycle, product consumers, cancellation race and engine tests, 120 passed; independent code and architecture review Not-tested: Full G006 product and Channel acceptance remains in subsequent slices
…ntext Persist product reference sections and a restrictive shared-Memory flag with Run inputs. Workspace enforces the restriction on ordinary mutations as well as distillation. Captured Tool declarations opt into bounded media presentation while omitted fields preserve existing Snapshot hashes. Constraint: Context source data cannot create new authorization Rejected: Prompt-only Memory isolation | ordinary file writes would bypass it Confidence: high Scope-risk: moderate Tested: Isolated staged export Snapshot, Tool and Workspace tests, 96 passed; independent cross-owner review Not-tested: Full product composition and live Model interpretation remain separate verification
…kend Reuse the application-owned storage backend for bounded input blobs. A separate publication lock permits conditional mutation without non-reentrant lock acquisition, and exact revisions protect reads and cleanup. Confidence: high Scope-risk: narrow Tested: Real Local and controlled S3 SDK peers with PostgreSQL locks, 16 passed; independent code and architecture review Not-tested: Live S3 deployment and full attachment product acceptance
…thority Expose bounded Agent and Tenant intake queries and resolve the selected Model protocol through its owning execution service. Human candidate reads stay within captured visibility; autonomous callers receive no administrative configuration API. Constraint: Login lifetime must not govern independent Agent execution Confidence: high Scope-risk: moderate Tested: Independent owner tests for authorization, disabled records, bounded single-query batches and stored protocols; isolated staged export owner regression Not-tested: Live scheduled workflows and product transport are verified separately in G006
Bind message execution references to their exact input and Group conversation. Register attachment publication, Group participation and Channel transport relations in the shared pre-baseline S2 graph without introducing another execution state machine. Constraint: G008 owns the first target migration; startup never creates schema Confidence: high Scope-risk: moderate Tested: Isolated staged export real PostgreSQL S2 and negative product constraints, 60 passed; independent schema review Not-tested: Production migrations and live Channel delivery
Implement direct and Group conversation acceptance, fixed history cutoffs, Waiting associations and immutable attachment publication through existing Run transactions. Session retains Goal continuation policy; Group retains conversations and read watermarks. Neither duplicates Run lifecycle. Constraint: Visible messages, execution results and file publication remain separate facts Confidence: high Scope-risk: broad Tested: Isolated staged export Session and Group PostgreSQL suites, 94 passed; independent ownership, cutoff and file-publication reviews Not-tested: Complete G006 application qualification; A2A private-to-shared file publication policy remains unresolved
…integration Retain the original product contracts and append reviewed owner amendments for explicit scheduled delivery, related-input waits, authorized takeover and temporary file return. Result visibility remains tied to private provenance rather than the chosen output location. Constraint: No new Workspace type, Task lifecycle or crash recovery Confidence: high Scope-risk: moderate Tested: Independent code/security and architecture preflight; owner-contract and goal-gate validators Not-tested: Implementation acceptance and formal platform qualification remain outstanding
… storage Capture the human-input and shared-file restrictions with execution. Keep Child questions authorized without enabling human waits on the unattended Main. Related-input waiting uses the existing Run transaction and unseen-input check, with application-validated A2A control rather than arbitrary Tool JSON. Constraint: Default Snapshot and History fields retain existing encoded shape Confidence: high Scope-risk: moderate Tested: Isolated staged export Snapshot, codec, lifecycle, engine and policy-boundary tests, 264 passed; independent implementation review Not-tested: Complete G006 product integration and formal performance qualification
…an inputs Extend existing product records for external scheduled replies, Run-created attachment binding, current A2A recipients and bounded temporary-file metadata. Exact source foreign keys and cleanup constraints retain ownership across independent execution and delivery. Constraint: All changes remain in the shared pre-baseline schema; no Artifact or Task table Confidence: high Scope-risk: moderate Tested: Isolated staged export real PostgreSQL S2 and product/continuation constraints, 85 passed; independent schema review Not-tested: Production migration and complete product acceptance
Session and Group accept authorized external messages with the real creating Run and retain message-bound attachments. Pin bounded work reads to selected identities so concurrent input cannot cause false corruption. Constraint: Scheduled publication must not fabricate human input or broaden private destinations Confidence: high Scope-risk: moderate Tested: Isolated staged tree Session, Group and attachment owner tests: 113 passed Not-tested: Live Channel delivery and complete G006 application acceptance
Preserve the original request while an authorized same-conversation Main can take over delivery and provide additional explicitly authorized attachments. The request owns bounded temporary publication and return receipts without exposing receiver shared files. Constraint: A2A does not inherit the sender Workspace or revive terminated Runs Confidence: high Scope-risk: moderate Tested: Isolated A2A and Run tests: 221 passed; independent answer-chain review: 65 passed Not-tested: Real external providers and formal concurrent platform qualification
Trigger and Heartbeat admit bounded immutable occurrences with explicit destinations and separately frozen source visibility. Personal connection metadata preserves ownership even when the account is disabled; it never grants execution. Constraint: Restart does not replay unfinished work or infer a destination Confidence: high Scope-risk: moderate Tested: Isolated Trigger, Heartbeat and A2A visibility tests: 68 passed Not-tested: Hosted scheduling and full result fragment access, which is a remaining G006 repair
Retain the seven provider adapters behind authenticated intake and bounded delivery attempts. Preserve reply context and known fragment identifiers, and contain uncertain external effects without replaying interrupted Runs. Constraint: Delivery acknowledgement does not prove Run completion, and Final does not prove delivery Confidence: high Scope-risk: moderate Tested: Isolated Channel owner and adapter suite: 115 passed Not-tested: Live provider credentials, webhooks and hosted listener connectivity
Bound attachment previews and document extraction with application-authorized readers, supervised child processes and complete-result size limits. Temporary file storage retains immutable bytes and compare-and-swap publication without becoming a Workspace. Constraint: Process resource containment is not a security Sandbox Confidence: high Scope-risk: moderate Tested: Isolated attachment, document and temporary-storage tests: 39 passed; independent temporary PDF and DOCX application tests: 2 passed Not-tested: Linux hard memory limits, live Models and deployment qualification
…ndaries Wire authenticated HTTP and WebSocket intake, conversational tools, independent A2A, scheduled intake, Channel delivery and bounded attachment resources into the application lifespan. Preserve message acceptance versus terminal execution and drain producers before Runtime shutdown. Constraint: No legacy runtime, frontend migration or interrupted-work replay Confidence: high Scope-risk: broad Tested: Isolated E2E and execution dependencies: 272 passed; architecture: 1779 passed plus Git-tracking check passed after initializing isolated Git metadata; Ruff and Pyright passed Not-tested: Live providers and formal mixed-load qualification; complete scheduled output reader follows separately
Expose bounded terminal-result fragments through owner-authorized HTTP and native Tool paths. Original Membership, Group or Agent visibility is checked before Run output is read; no duplicate result store or task lifecycle is introduced. Constraint: Destination-free work must remain queryable beyond its 512-character preview Confidence: high Scope-risk: moderate Tested: Isolated scheduled and metadata regression: 97 passed; independent result authorization review: 5 passed; Ruff and Pyright passed Not-tested: Live providers and formal mixed-load qualification
Align Workspace guidance with the confirmed Memory and A2A restrictions, mark continuation implementation current, and record isolated committed-scope evidence. Preserve the explicit missing mixed-load driver and live qualification boundaries. Confidence: high Scope-risk: narrow Tested: Isolated final Backend suite: 3517 passed, 1 skipped; app/tests Ruff, Pyright and governance checks passed; changed Note links and diff checks passed Not-tested: Formal mixed-load qualification is blocked by the missing mixed scenario; no live providers, deployment or frontend acceptance Directive: Do not treat functional regression as completion of the formal G006 mixed-load gate
…tion Map all owners, pending product decisions and cross-owner capabilities without changing approved contracts or treating the proposed sequence as implementation approval. Constraint: Performance execution remains paused and unrelated installation drafts stay untouched Confidence: high Scope-risk: narrow Tested: 34 unique owner rows, 17 product entries, 401 coverage states and local links validated; staged diff check passed Not-tested: Exhaustive historical dynamic consumers; no business code or runtime tests changed
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
Establish the clean-break backend foundation and product-input execution paths on
develop, with explicit ownership, durable Run state and source-attributable model inputs. This is an in-progress rewrite checkpoint; it is not a complete platform release.Scope and remaining work
Source:
Y1fe1Zh0u:developat7520f3cd1c67ec32a6fb63a850097188af1e74e4. This PR contains committed history only. Local Market/MCP/Skill installation drafts and frontend prototypes are excluded.The owning inventory is
backend/rewrite/remaining-work.md. Full Auth and other product workflows, management entry points, frontend replacement, the G008 target database baseline and fresh-environment qualification remain open. The mixed-product load runner is not implemented and performance execution remains paused. No production, live-provider, browser-flow or full-platform qualification is claimed. Do not merge this checkpoint as a deployable release.Validation
Fresh checks use an isolated Git worktree at the source commit, reusing installed dependencies:
ruff check app testspassed;pyright --pythonpath <existing-backend-venv>/bin/python appreported 0 errors and 0 warnings.npm testpassed all 204 tests;npm run lint,npm run format:checkandnpm run buildpassed.bash scripts/arch-guard.shpassed with 37 legacy frontend file-length warnings.python3 -B scripts/validate_goal_gates.py --manifest rewrite/goal-gates.jsonandpython3 -B scripts/check_owner_contracts.py check --manifest rewrite/owner-contracts.jsonpassed.git diff --check origin/develop...HEADpassed.The full-directory
ruff check .reports 230 findings in frozen legacy Alembic revisions; these revisions are unchanged relative to upstream main. They are not part of the app/tests lint success claim. The initial Pyright invocation could not resolve the isolated worktree's interpreter; the explicit-interpreter rerun above passed.<existing-backend-venv>/bin/python -m pytestpassed with 3517 passed, 1 skipped, 4 warnings in 548.25s, on this exact source commit. The existing locked dependency environment was reused; no new dependency installation was performed.