fix(agent-org): isolate runtime persistence namespace - #836
Draft
ShiboSheng wants to merge 1 commit into
Draft
Conversation
Move the redesigned Agent Org runtime into the canonical agent_org_runtime_* tables and retire the exact legacy table set atomically on startup. Isolate flat Team definitions at agent-org-definitions.json while preserving ordinary Rust and CLI session data across downgrade and re-upgrade. Pre-commit hook ran. Total eslint: 0, total circular: 0
This was referenced Aug 18, 2026
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.
Problem
Replaces #828.
Fixes #791.
Agent Org's redesigned runtime still shared its private SQLite table names and definitions-file path with older releases. Downgrading could therefore recreate an incompatible legacy schema, and reopening the redesigned build could hit column mismatches before ordinary Rust or CLI Session history loaded.
This is the third PR in the stack: #834 -> #835 -> this PR. It is based directly on
codex/issue-757-pr2-selected-rebuild.Solution
agent_org_runtime_*namespace.BEGIN IMMEDIATEtransaction to validate the complete canonical manifest, drop only the exact 13 retired table names, create a fresh canonical namespace when absent, revalidate it, and roll back on any failure.agent-org-definitions.json; deleteagent-orgs.jsonwithout parsing or migrating it, and never fall back to the retired path when cleanup fails.last_activity_outcome IN ('completed', 'failed', 'cancelled')while keeping Team status restricted tostarting,running,paused,idle,failed, andarchived.last_activity_outcome = 'cancelled'under a valid Team status, then separately provesstatus = 'cancelled'is rejected by SQLite.Potential risks
agent-orgs.jsonfile are intentionally deleted. Legacy Agent Org runtime state and legacy custom Team definitions are not recoverable through this change.ORGII_HOMEis also unsupported.agent_org_runtime_*tables remain isolated for a later return to the new build.Verification
Passed on this PR tip:
cargo test -p agent_core core::coordination::schema -- --nocapture— 8 passed, including the two-constraint cancellation DDL test. Measured 25 samples: fresh median 4.429 ms, canonical no-op median 2.679 ms, and 13-table cleanup median 3.108 ms.cargo check -p agent_core -p app_paths -p org2 -p session_persistence --all-targetscargo clippy --workspace --all-targets -- -D warningspnpm run typecheckpnpm run lint— 0 errors; 5 existing unused-value warnings.cargo test --workspace— complete workspace and doc-test suite passed when rerun outside the restricted sandbox so loopback-port tests could bind.git diff --check origin/develop...HEADAlso attempted:
cargo fmt --all -- --checkreports existing formatting differences in files identical toorigin/develop; no changed file in this stack contributes to the output.pnpm run check:circularreports two unresolved raw runtime imports from unchangedreactArtifactDocument.ts; both that file and the checker are byte-identical toorigin/develop.No frontend or wire file changes in this PR layer, so new UI screenshots are not applicable. The packaged cross-version matrix remains not run.
Architecture and performance audit
Architecture review covered compilation, removal of the old fingerprint/reset ownership path, canonical naming, namespace semantics, fail-closed defaults, shared-data boundaries, developer clarity, unchanged wire contracts, initializer parity, and definitions-path resolution.
The runtime cost is startup-only: one SQLite transaction over schema metadata and a fixed 13-name retirement list. There is no new polling, timer, worker, subscription, cache, row scan, or idle/hidden background work. Concurrent same-version initialization is serialized by SQLite and covered by a two-connection test.
Commit provenance
b7e24bd1515b058672c2ba8959465214f1ecd968-> adapted commitfe20ec604902d956b98aa7fab00bdd1469d9f7e3, authored by Shibo Sheng. The adaptation retains the selected stack's local coordinator constant and adds the required DDL constraint test; no other PR fix(agent-org): isolate runtime persistence namespace #828 commit is present.