feat(code-editing): Step 3 — multi-file model + agent versioning (data layer) - #66
Merged
Merged
Conversation
…a layer)
Per the approved design (Part B). PURE DATA LAYER — no build, no dispatch change.
- agent_versions table: (id, agent_id, version_no, files JSONB {path:content},
requirements JSONB, params_schema JSONB, image_ref, status, created_at),
UNIQUE(agent_id, version_no). hosted_agents.active_version_id pointer.
- Backfill (migration 069 + mirrored in check_db, idempotent): each existing agent's
single-file code -> one v1 version row {entrypoint: code}, entrypoint by runtime
(agent.py / agent.ts), params_schema carried, no requirements. hosted_agents.code
left untouched.
- core/agent_versions.py: data-access helpers (create_version, get_active_version,
get_version, list_versions, activate_version [ownership-guarded], next_version_no).
VERIFIED:
- Migration run against real Postgres 18.3 (representative + edge-case agents:
python/node/no-schema/null-code): each agent -> correct v1 mirror + active_version_id;
code byte-identical pre/post; idempotent re-apply; down-migration leaves hosted_agents
identical (reversible).
- Dispatch UNCHANGED: active_version_id/agent_versions referenced ONLY by the migration
+ data layer + tests; cloud.py has 0 refs and still reads hosted_agents.code.
- 14 new unit tests (fake-db data layer). Full suite 607 passed.
Backward-compatible: old single-file agents become one-file v1 versions, behavior
unchanged. Mirror NOT required for this step (no build here) — see PR notes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🚅 Deployed to the wayforth-pr-66 environment in wayforth
8 services not affected by this PR
|
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.
Step 3 of code-editing v1 — the versioning data layer, per the approved design (Part B). Builds on the canary-proven security core (Steps 1–2). Pure data layer, no merge — for review.
What's here
agent_versionstable:(id, agent_id, version_no, files JSONB {path:content}, requirements JSONB, params_schema JSONB, image_ref, status, created_at),UNIQUE(agent_id, version_no), FK→hosted_agentsON DELETE CASCADE.hosted_agents.active_version_idpointer (nullable FK→agent_versions).069+ mirrored incheck_db): each existing agent's single-filecode→ one v1 version row{entrypoint: code}(entrypoint by runtime —agent.py/agent.ts),params_schemacarried over, no requirements.hosted_agents.codeis left untouched.core/agent_versions.py: data-access helpers —create_version,get_active_version,get_version,list_versions,activate_version(ownership-guarded so one agent can't point at another's version),next_version_no.Confirmation (1): migration is safe + reversible, dispatch unchanged ✅
Ran the actual
069file against a real Postgres 18.3 with representative + edge-case agents (python, node, no-schema, null-code):active_version_id/agent_versionsare referenced only by the migration, the data layer, and tests.cloud.pyhas 0 references and still dispatches fromhosted_agents.code(cloud.py:373), which the migration never writes. The active pointer is inert until Step 4 wires it.already exists, skipping+ theNOT EXISTS/active_version_id IS NULLguards make the backfill a no-op, socheck_dbis safe on every boot.DROP COLUMN active_version_id; DROP TABLE agent_versions;;.codeis never touched.Confirmation (2): the private mirror is NOT a blocker for this step
The mirror is needed by the build pipeline (Step 1's install-from-mirror). Step 3 builds nothing — backfilled v1 versions have
image_ref=NULLand no requirements, and dispatch still runs the unchanged.codepath. So the mirror is a parallel infra task, needed at Step 4 (when save→redeploy wires the build that installs deps from the mirror). It can be stubbed/deferred until Step 4; not a blocker here.🤖 Generated with Claude Code