Repository navigation
spike: isolate pure plugin reconciler - #7451
t3-code[bot] wants to merge 7 commits into
Conversation
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces a complete new plugin runtime system (~1300 lines of new code) with complex async lifecycle management. Beyond the scope being significant new capability rather than a minor change, there is an unresolved High severity finding about a potential deadlock with function-valued thenables that warrants attention. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
|
addressed the review findings in
23 tests pass with node 24.13.1, including the 20,000-plugin chain, plus typecheck, lint, formatting, frozen install, and the demo. |
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
|
addressed the latest findings in
26 tests, including the 20,000-plugin chain, typecheck, lint with warnings denied, formatting, and frozen install pass on node |
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c72d46c. Configure here.
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
|
addressed the latest review findings in
30 tests, typecheck, lint with warnings denied, formatting, frozen install, and the demo pass on node |
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
Dismissing prior approval to re-evaluate 9b33da6
|
synced the plain-function callback return regression test and fix in 31 tests and the full local validation pass on node |
| const callbackState = { active: true }; | ||
| try { | ||
| const result = callbackContext.run(callbackState, invoke); | ||
| if (typeof result === "object" && result !== null && "then" in result) { |
There was a problem hiding this comment.
🟠 High src/pureRuntime.ts:188
A function-valued thenable returned by a plugin clears callbackState.active before it settles, so a reentrant runtime.reconcile() or dispose() queues behind the current transition and deadlocks when that transition awaits the thenable. The check only recognizes object results; detect function thenables as well before clearing the callback state.
| if (typeof result === "object" && result !== null && "then" in result) { | |
| if ((typeof result === "object" || typeof result === "function") && result !== null && "then" in result) { |
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @packages/plugin-runtime-poc/src/pureRuntime.ts around line 188:
A function-valued thenable returned by a plugin clears `callbackState.active` before it settles, so a reentrant `runtime.reconcile()` or `dispose()` queues behind the current transition and deadlocks when that transition awaits the thenable. The check only recognizes `object` results; detect function thenables as well before clearing the callback state.
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
|
Consolidated into #8007 as one PR targeting main. |

what changed
why
this lets reviewers evaluate the planner without effect-scope or cordis lifecycle machinery in the same diff. it is the smallest runtime model and is useful as the deterministic planner half of the recommended hybrid.
validation
24.13.1, including a 20,000-plugin dependency chainlimits
this is an isolated runtime poc. it does not load packages, add a sandbox, expose plugin rpc, or wire product ui.
checklist
request provenance
Note
Medium Risk
The reconciler’s lifecycle and commit/rollback semantics are subtle and security-relevant for future plugin loading, but the change is an isolated private package with broad tests and no production wiring.
Overview
Adds a new private
@t3tools/plugin-runtime-pure-pocpackage that extracts the framework-free plugin reconciler from the broader runtime experiment so it can be reviewed on its own.createPureRuntimeimplements iterative capability-graph planning (stack-safe, cycle detection, missing-deps blocking), targeted restarts when definitions or upstream capabilities change, LIFO finalizers, staged activation with rollback on failure, frozen contribution snapshots, serialized transitions with reentrancy guards viaAsyncLocalStorage, and dependent-first teardown with aggregated cleanup errors.A shared
defineRuntimeContracttest suite (plus manifest tests and a 20k-plugin chain test) locks in lifecycle, rollback, observer, and edge-case behavior.PluginManifestEffect Schema validates namespaced ids, semver, capability ids, safe relative entrypoints, and declarative mobile surfaces. Ademoscript benchmarks a 250-plugin chain. Explicitly out of scope: package loading, sandbox, RPC, or product UI.Reviewed by Cursor Bugbot for commit ae67af9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add pure plugin reconciler POC with topological activation and lifecycle management
@t3tools/plugin-runtime-pure-poc) underpackages/plugin-runtime-poc/that manages plugin activation, deactivation, and reconciliation without recursion.pureRuntime.tsimplementscreatePureRuntime: plugins are ordered via iterative DFS, staged activations run in dependency order, and finalizers execute LIFO on retirement or dispose.manifest.tsdefines aneffect/Schema-basedPluginManifestthat enforces namespaced IDs, strict semver, safe relative entrypoints, and disallows mobile executable entrypoints.runtimeContract.tsprovides a reusable test harness (defineRuntimeContract) covering activation order, reentrancy rejection, rollback, LIFO cleanup, snapshot immutability, and cycle detection.demo.tsscript runs sample activations and benchmarks a 250-plugin dependency chain, printing a structured JSON report.Macroscope summarized ae67af9.