Skip to content

Commit 93ffae9

Browse files
authored
Merge pull request #7 from xcastdev/docs/migration-name-guard
docs(plans): match the migration-name guard to upstream below V2
2 parents 47c2366 + a76f033 commit 93ffae9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎docs/plans/upstream-workflow-and-assistants.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ No import of unused main-installation Work/team/memory/archive records. New doma
6969

7070
## Design grounded in target sources
7171

72-
1. **Additive storage, unchanged upstream history.** Target `apps/server/src/persistence/Migrations.ts` has IDs 1–67, including immutable V2 migration 55 and V1 cleanup 63. Keep the upstream migrationEntries byte-for-byte unchanged. Add a separate feature migration runner with its own `t3_workflow_v2_migrations` ledger and independently numbered feature migrations, executed only after upstream migration/preview reconciliation succeeds. All new feature tables use the `t3_workflow_v2_` prefix; do not reuse `t3_fork_migrations`, unprefixed main tables or upstream IDs. Before any migration/runtime startup, a read-only compatibility preflight compares every recorded upstream migration ID/name with this branch's upstream manifest. Unknown/ahead IDs or any differing name refuse startup; an older valid prefix may migrate normally. Place this guard at feature startup/Sqlite layerSetup before the existing upstream runner can merely warn and continue, preserving its guards and manifest unchanged. A preflight validates ledger shape/recorded names and feature-owned object schemas; a foreign or unexpected object at a reserved name fails closed, never `IF NOT EXISTS` over an unknown shape. Main fork migration 001 alters dropped `projection_turns`; importing it would fail. `projection_projects` is still authoritative through V2 `ProjectStore`; old retained V1 thread/PR projections are importer inputs, not live Work reads. Preserve `initializeV2Database.ts`, preview reconciliation and lazy `legacy/LegacyV1ThreadImporter.ts`.
72+
1. **Additive storage, unchanged upstream history.** Target `apps/server/src/persistence/Migrations.ts` has IDs 1–67, including immutable V2 migration 55 and V1 cleanup 63. Keep the upstream migrationEntries byte-for-byte unchanged. Add a separate feature migration runner with its own `t3_workflow_v2_migrations` ledger and independently numbered feature migrations, executed only after upstream migration/preview reconciliation succeeds. All new feature tables use the `t3_workflow_v2_` prefix; do not reuse `t3_fork_migrations`, unprefixed main tables or upstream IDs. Before any migration/runtime startup, a read-only compatibility preflight compares every recorded upstream migration ID/name with this branch's upstream manifest. Unknown/ahead IDs refuse startup, as does a differing name at or above V2 migration 55; below it a site-local name is tolerated, as upstream's migrator does. An older valid prefix may migrate normally. Place this guard at feature startup/Sqlite layerSetup before the existing upstream runner can merely warn and continue, preserving its guards and manifest unchanged. A preflight validates ledger shape/recorded names and feature-owned object schemas; a foreign or unexpected object at a reserved name fails closed, never `IF NOT EXISTS` over an unknown shape. Main fork migration 001 alters dropped `projection_turns`; importing it would fail. `projection_projects` is still authoritative through V2 `ProjectStore`; old retained V1 thread/PR projections are importer inputs, not live Work reads. Preserve `initializeV2Database.ts`, preview reconciliation and lazy `legacy/LegacyV1ThreadImporter.ts`.
7373
2. **One execution owner.** Port Work's domain decider/repository, approvals and durable assignment intentions. Replace `ProjectTeamProviderSessions`, private Pi execution and V1 engine calls with V2 `ThreadManagementService`, `ThreadLaunchService`, `ProviderTurnStartService`, existing EffectOutbox/EffectWorker and runtime requests. MCP `delegateTask` currently requires an active parent run; background Work must not fabricate one. An initial assignment uses a V2-owned assignment thread/run with Work lineage. Delegation from an active coordinator uses existing `delegated_task.request`; criterion-derived queued assignments keep durable Work parent/root linkage even when no live conversational parent exists.
7474
3. **Atomic admission seam, not another scheduler.** Add a small server-only `RunAdmission` interface in orchestration V2. V2 resolves the authoritative owner from the target thread and any originating owned session, independently of caller-supplied fields. Work or assistant adapters resolve durable fence/configuration references from that binding. Every run-creating or promoting command validates the resolved owner, compares current SQL authority, and binds the admitted run in the same transaction as its existing receipt/events/outbox. Caller references can only narrow or match this authority, never remove it. Replays return the recorded result; revoked authority cannot authorize a different command. Before provider start, queued runs recheck current permission/lifecycle and the retained assignment fence, then use the admitted configuration snapshot. The interface performs SQL-only checks inside the transaction; no model, provider, Git or network effects there. Keep domain-specific checks in their domain adapters and composition, avoiding V2 importing Work modules. Unowned ordinary paths retain upstream behavior. Owned inference is denied while disabled/archived/revoked, including internal continuation and wake paths; pure result recording, archive retention, cleanup and cancellation may proceed without starting inference. Owner lookup and checks are mandatory inside the serial V2 commit and again at provider start, not merely in ThreadManagementService. A durable domain intention can retry the same command; V2 owns effect retries and native recovery. Unproved native starts/stops remain uncertain and retain reservations until reconciliation.
7575
Descendants inherit Work root/owner/fence/deadline and count against depth/concurrency inside admission commitment. Assistant children inherit selected tool/skill limits and current owner policy but receive no implicit memory-sharing grant. Owned `t3_thread_launch`/`create_threads` cannot escape into unowned top-level work: deny those agent-originated launches with guidance to permitted delegation. Owned `schedule_task` is denied unless the current owner explicitly permits routine creation; allowed assistant routines bind the same assistant through the existing scheduler and cannot launch Project Work. Owner stop/drain traverses all bound descendants, retaining uncertain native outcomes. These T3 admission rules do not sandbox provider-native plugins.

0 commit comments

Comments
 (0)