fix(agent-org): isolate runtime persistence namespace - #828
Open
ShiboSheng wants to merge 3 commits into
Open
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
- drop the three ghost DROP INDEX statements in the inbox DDL (…run_task_assignment_v2/_v3 and …causation_once): those names never existed in the runtime namespace, and the schema manifest owns versioning now. sqlite_master is unchanged, so the expected manifest regenerates identically. - include 'view' in the coordinator's three sqlite_master type filters (manifest query, legacy-object count, unknown-object report) so a view in the namespace can no longer hide from verification. - fix stale docs naming retired tables: agent_inbox/schema.rs module and init docs, agent_org_tasks module and init docs, core_types::tool_names ORG_SEND_MESSAGE, e2e-test member-idle probe. - doc-comment every module-level pub fn init_schema as tests-only — production initialization goes through the namespace coordinator.
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
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.
The previous pull request also accumulated follow-up commits that changed the approved design by adding a destructive schema epoch, migrating the retired definitions file, scanning legacy rows, and changing unrelated task-migration behavior.
Supersedes #799.
Fixes #791.
This is the third PR in the stack: #824 → #825 → this PR.
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.The candidate
c4190d9commit is not present in the final history because it only renames watchdog test calls toruntime_connection(), an API introduced by the explicitly excluded497ddc1commit. PR #825 correctly retainsget_connection(), so applyingc4190d9would not compile; adapting it produces no source change.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
cargo test -p agent_core core::coordination::schema -- --nocapture— 7 passed. Measured 25 samples: fresh median 4.41 ms, canonical no-op median 2.75 ms, and 13-table cleanup median 3.12 ms.cargo test -p agent_core agent_org -- --nocapture— 225 passed.cargo test -p agent_core core::definitions::orgs -- --nocapture— 13 passed.cargo test -p session_persistence turn_intents -- --nocapture— 13 passed.cargo test -p org2 agent_sessions::session_directory::aggregation::tests -- --nocapture— 13 passed.cargo check --workspace --all-targets— passed.cargo clippy -p agent_core -p app_paths -p org2 -p session_persistence --all-targets -- -D warnings— passed.git diff --check origin/codex/issue-757-pr2-clean-stack...HEAD— passed.runtime_connectionchanges are absent.No frontend or wire files changed, so UI screenshots are not applicable.
Architecture and performance audit
Architecture review covered compilation, deletion of the old fingerprint/reset 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