Attempt 1

Back to durable goal · Attempt history

Hypothesis

A small adapter around @deepseek-ai/cordis@4.0.1 can provide durable, transactional runtime packages behind a fixed MCP stdio surface without embedding DeepSeek Harness or restarting the MCP connection.

Exact inputs

  • Parent checkpoint: task-start state of branch t3code/runtime-modifiable-plugin
  • Cordis: @deepseek-ai/cordis@4.0.1
  • MCP server/client: @modelcontextprotocol/server@2.0.0 and @modelcontextprotocol/client@2.0.0
  • Node: repository-pinned Node 24.13.0
  • Package source contract: one import-free JavaScript expression returning a Cordis plugin with apply(ctx)

Candidate plan

  1. Add an ordinary Bazel package with a dedicated exact pnpm lock.
  2. Persist definitions as content-addressed immutable source plus atomic manifests under explicit project and scratch roots.
  3. Evaluate each generation in a worker, mount it through a real Cordis Context and Fiber, and register handlers through Cordis effects.
  4. Activate transactionally: prove the candidate ready, swap the active pointer, drain in-flight calls, then dispose the prior Fiber exactly once.
  5. Expose fixed MCP tools for list, inspect, define, run/reload, invoke, stop, remove, and promote; never rely on dynamic MCP schema refresh.
  6. Seed and execute repo_context, git_worktree, and network_probe through the same runtime path.

Review packet

  • Explicit (scope, name) identities prevent hidden scratch/project shadowing.
  • Workspace root is an explicit CLI argument or BUILD_WORKSPACE_DIRECTORY, never inferred from a runfiles cwd.
  • A failed candidate never changes the active manifest or runtime pointer.
  • Package stdout/stderr cannot corrupt MCP stdout.
  • Disposable state remains under ignored out/mcp_cordis; reusable source is public project code.

Verdict

Refine. Candidate c9300c9887104777c8915e3d4f390196604e9bd18497bbec319415d1a4ad057f proved the architecture but failed acceptance criterion 7.

Work performed

  • Added the exact pnpm/Bzlmod/Bazel package and documentation.
  • Implemented content-addressed storage, worker-isolated Cordis Fibers, transactional generation replacement, fixed MCP gateways, and stdio entry.
  • Added project and scratch scopes, promotion, recovery, and three starter package definitions.
  • Added lifecycle, in-memory MCP, subprocess stdio, and package execution tests.

Verification evidence

  • bazel_agent bazel query //projects/mcp_cordis:all: pass after the pnpm v10 declaration and starter catalog were present.
  • bazel_agent bazel test //projects/mcp_cordis:runtime_test: pass. This covers real Cordis contexts/effects, immutable versions, rollback, drain, scopes, promotion, restart, removal, isolation, and fixed MCP invocation.
  • bazel_agent bazel test //projects/mcp_cordis:stdio_test: pass. One stdio client hot-updated v1 to v2 without a process change; a new server process recovered the project package.
  • bazel_agent bazel test //projects/mcp_cordis:starter_packages_test: fail because repo_context_search received spawn rg ENOENT in the hermetic test PATH.

Acceptance results

  1. Pass: documented standalone stdio server built and exercised by Bazel.
  2. Pass: source and runtime tests use Cordis Context, Fiber await/dispose, and effect cleanup.
  3. Pass for implemented lifecycle operations; fixed MCP use is proven on one connection.
  4. Pass: content hashes, failed syntax/startup rollback, and v1/v2/v3 behavior are exercised.
  5. Pass: roots and exact scope identity are exercised in isolated workspaces.
  6. Pass: promotion and server-only project recovery are exercised.
  7. Fail: the Git and network package paths were not reached after the repository search package required an unavailable rg executable.
  8. Pass: in-memory and real stdio tests invoke new handlers through the stable gateway without reconnecting.
  9. Unverified: the full integrated fixed regression set has not run.

Progress, approach, and process audit

  • Criteria 1–6 and 8 improved from unverified to measured passes. Criterion 7 is an absolute portability failure, not merely a weaker result.
  • Passing lifecycle and stdio tests support retaining the direct Cordis, worker, storage, and fixed-gateway representation.
  • The highest-leverage problem is removing the starter package’s undeclared executable assumption while retaining ripgrep as a fast path.
  • Continue the architecture but revise repo_context_search; no evidence supports discarding the runtime foundation.
  • The largest avoidable delay was 144 seconds in a failed test whose worker was not registered for unconditional teardown. node:test cleanup now registers before assertions, reducing the next failure cycle to under a second.
  • The next feedback loop starts with the single starter target and only then returns to the integrated regression set.