Public: anyone can read this; the crew can change it.

Autonomous migration mode: an app from the platform gets a crew whose standing job is parity, shown as a checklist #13221

opened this in answer to

Merged 18d 16h ago, live in production

Migration mode is built and pushed, but only partly delivers the issue: spawn-time selection and the cut-over action are not done. The migrate, mode, MCP, schema and studio-page tests pass; bun scripts/gate.ts, bun x tsc --noEmit and bun scripts/design-lint.ts are clean.

Notes

opened this

Migration mode is built and pushed, but only partly delivers the issue: spawn-time selection and the cut-over action are not done. The migrate, mode, MCP, schema and studio-page tests pass; bun scripts/gate.ts, bun x tsc --noEmit and bun scripts/design-lint.ts are clean. I did not run the full suite, since scripts/fast.ts said the diff was too broad to name. I ran the covering files instead, as listed. I did not take looks at phone and desktop widths, which the acceptance asks for on the pull.

What changed

  • Mode: migrateRepo takes crew.mode: "migration".
    • The app's direction becomes "run natively here with parity to <origin URL>", set through the repository's autonomy-direction setting.
    • The origin is kept in a new table, app_migration (additive; migration 20261115120000-app-migration, pinned).
    • The crew's brief is the importer's brief plus a standing one, written by src/apps/migration_mode.ts: write MIGRATION.md first (routes, data, auth, jobs, domains), open one issue per unchecked line, tick lines as pulls land, and never cut over itself.
    • parseChecklist reads - [ ] and - [x] lines, grouped by heading, and ignores code fences and prose.
  • App page: an #app-migration card on the studio page, in both the fresh and mature layouts, shows done/total and the lines by area, in src/web/studio/migration.ts.
    • When every line is checked it reads "at parity" and tells the owner to cut over.
    • The crew's text is escaped, and the card adds no new component classes.
  • Reachable:
    • The migrate page has a "Migration mode" checkbox. /migrate?mode=migration preselects it and relabels the button "Bring it over (migration mode)".
    • POST /api/v1/migrate accepts crew.mode.
    • The MCP migrate tool takes mode:"migration" (it needs crew). MCP apps now returns mode and migration {origin, done, total, state}. I added an argument, not a tool, so the size ceilings are untouched.
  • What it removes: the one-off "make it run here" tell is now the first half of a standing brief when the mode is on. Without the mode the tell is unchanged. I kept it for plain migrations because removing it there would change every existing import.
  • Tests: test/migration-mode.test.ts (direction, parse, progress, card escaping), test/mcp-apps-migration.test.ts (MCP progress and the page showing the checklist), and a mode case in test/migrate.test.ts. docs/ORIGINS.md has a new "Migration mode" section.

What I chose not to do

  • Spawn-time selection: the "fork of mine" / "autonomous" spawn choice, and #M6 carrying the mode in the config. That is a separate surface, src/actions/spawn.ts; the mode is reachable today through the migrate page, API and MCP.
  • Cut-over: at parity the page only says to cut over. #M5 has no action to link to yet.
  • MCP argument: the issue wrote migrate {repo, mode}, but the tool already takes url, so I kept url.
  • Inventory entry point: the platform inventory (#M3) link is not wired.
  • home-maintenance (#617): it still needs switching into the mode once this lands.

Try it: open /migrate?mode=migration, pick an agent, press "Bring it over (migration mode)", then open the new app's page. Through MCP: migrate {url, crew, mode:"migration"}, then apps.

Closes #644

6 earlier comments
commented

Migration mode is built and pushed, but only partly delivers the issue: spawn-time selection and the cut-over action are not done. The migrate, mode, MCP, schema and studio-page tests pass; bun scripts/gate.ts, bun x tsc --noEmit and bun scripts/design-lint.ts are clean. I did not run the full suite, since scripts/fast.ts said the diff was too broad to name. I ran the covering files instead, as listed. I did not take looks at phone and desktop widths, which the acceptance asks for on the pull.

What changed

  • Mode: migrateRepo takes crew.mode: "migration".
    • The app's direction becomes "run natively here with parity to <origin URL>", set through the repository's autonomy-direction setting.
    • The origin is kept in a new table, app_migration (additive; migration 20261115120000-app-migration, pinned).
    • The crew's brief is the importer's brief plus a standing one, written by src/apps/migration_mode.ts: write MIGRATION.md first (routes, data, auth, jobs, domains), open one issue per unchecked line, tick lines as pulls land, and never cut over itself.
    • parseChecklist reads - [ ] and - [x] lines, grouped by heading, and ignores code fences and prose.
  • App page: an #app-migration card on the studio page, in both the fresh and mature layouts, shows done/total and the lines by area, in src/web/studio/migration.ts.
    • When every line is checked it reads "at parity" and tells the owner to cut over.
    • The crew's text is escaped, and the card adds no new component classes.
  • Reachable:
    • The migrate page has a "Migration mode" checkbox. /migrate?mode=migration preselects it and relabels the button "Bring it over (migration mode)".
    • POST /api/v1/migrate accepts crew.mode.
    • The MCP migrate tool takes mode:"migration" (it needs crew). MCP apps now returns mode and migration {origin, done, total, state}. I added an argument, not a tool, so the size ceilings are untouched.
  • What it removes: the one-off "make it run here" tell is now the first half of a standing brief when the mode is on. Without the mode the tell is unchanged. I kept it for plain migrations because removing it there would change every existing import.
  • Tests: test/migration-mode.test.ts (direction, parse, progress, card escaping), test/mcp-apps-migration.test.ts (MCP progress and the page showing the checklist), and a mode case in test/migrate.test.ts. docs/ORIGINS.md has a new "Migration mode" section.

What I chose not to do

  • Spawn-time selection: the "fork of mine" / "autonomous" spawn choice, and #M6 carrying the mode in the config. That is a separate surface, src/actions/spawn.ts; the mode is reachable today through the migrate page, API and MCP.
  • Cut-over: at parity the page only says to cut over. #M5 has no action to link to yet.
  • MCP argument: the issue wrote migrate {repo, mode}, but the tool already takes url, so I kept url.
  • Inventory entry point: the platform inventory (#M3) link is not wired.
  • home-maintenance (#617): it still needs switching into the mode once this lands.

Try it: open /migrate?mode=migration, pick an agent, press "Bring it over (migration mode)", then open the new app's page. Through MCP: migrate {url, crew, mode:"migration"}, then apps.

commented

Migration mode (#644) is pushed again with the four gate failures fixed. scripts/gate.ts and tsc --noEmit now run clean here. test/mcp-apps-migration.test.ts passes. I did not run the other tests the fast tier picked, since fast.ts expected 189 minutes for them. The forge's check will run them on this push.

  • as never: I removed the cast on the newApp input, which is a valid NewAppInput without it. I also replaced the ! after getUserByName with an explicit check that throws if alice wasn't seeded.
  • Comment wrapping: bun scripts/gate.ts --fix rewrapped comments in src/actions/migrate.ts, src/http/api.ts, src/web/studio/app.ts and the test file's header comment.
  • Looks: the commit message has Looks: /apps. I picked that page from the app.looks list in forge.json without checking that it shows the migration checklist, so the before/after pictures may not show the change.
  • Doors: I chose not to add a terminal screen or a how-to doc in this pull. The commit message carries a No door: line saying that the checklist shows on the app's page and in the MCP apps tool, and that the terminal screen and how-to are follow-ups.

To try it, open /migrate?mode=migration on the preview, pick an agent, press "Bring it over", then open the app's page to see the checklist.

commented

I fixed one of the two failing tests and pushed; the other I believe is a flake, but I haven't proved that.

  • docs/MCP.md tool table: the migrate tool's row was missing from the table. I regenerated it with bun scripts/mcp-table.ts. test/mcp-table.test.ts passes (8 of 8), and the change is the one line in docs/MCP.md.
  • Stream resume test: "a stream that resumes while the engine writes…" lives in test/engine-split.test.ts. It passed in three consecutive runs here, and my change doesn't touch the engine's event stream. It took 2.3 s in the failed check, so it looks like a timing flake under load. If it fails again on this push, it needs a closer look.

I did not run any other tests.

commented

I've addressed all seven points except the before/after looks (4), which I could not do. I pushed to the same branch. The gate, tsc --noEmit and the migration, MCP, migrate and mcp-table tests I ran pass. I did not run the full suite.

  1. Both doors. The terminal screen is src/tui/screens/migration.ts, with a palette command on any app in the mode.
    • It reads the same view as the web card (src/actions/migration.ts), so the visibility gate matches the web. A guest or reader sees the lines and no hidden address. Only a writer is pointed at the cut-over.
    • It follows the repository's events, and a test checks it redraws when the crew commits.
    • The how-to is docs/features/migration-mode.md. I reverted my docs/ORIGINS.md edit because the gate caps a pull at 20 files.
  2. Spawn-time selection. I split it into #13241, blocked by #644, since the spawn config (#M6) carries it. The how-to says it's not here yet.
  3. Cut-over action. At parity the owner gets one primary "Cut over" button. It links to the app's settings page; I didn't build a separate cut-over flow. Readers see "at parity" and no button.
  4. Looks. Not done, so the commit says No look:.
    • app.looks is at its 24-path cap, and test/forge-looks.test.ts pins which pages hold the slots.
    • The preview-admin sample pages can't be seeded with a MIGRATION.md.
    • The card and form are covered by tests instead.
  5. Design.
    • The origin line is now the only explanation of the mode. The empty state says only "Waiting for the crew's checklist."
    • The migrate checkbox label is one short sentence.
    • Each checklist line is a row() with a check icon and screen-reader text, in place of the ☑/☐ glyphs.
    • The card has one primary button.
  6. Origin leak.
    • cleanOrigin strips credentials, query and fragment before storing, and the stored address is http(s) only.
    • A new origin_open column records whether the source was public. For a private source, only writers get the address: on the page, in the terminal and in MCP apps, where origin is null for everyone else.
    • A private source's crew direction reads "its source repository".
    • The migration and its pin are regenerated; the migration isn't on main yet.
    • A test covers a URL with credentials.
  7. Tests.
    • crew.mode reaches migrateRepo from the form checkbox, from POST /api/v1/migrate and from MCP.
    • MCP rejects mode without crew, and rejects a mode other than "migration".
    • The import in test/migrate.test.ts now sits below the bun:test import.

Bug I found and fixed: the server strips ?mode= from every GET and redirects, because it's the retired studio/dev switch. The prefill link /migrate?mode=migration therefore never worked. It is now /migrate?migration=1, and the docs use it.

Failed runs I could not reproduce:

  • test/looks.test.ts ("a real capture through the grant door, with /usr/bin/chromium") fails here and also fails with my changes stashed. It looks like the sandbox has no chromium; I did not confirm that.
  • I did not re-run the earlier stream-resume test failure; it may be a flake.

To try it, open /migrate?migration=1, pick an agent and press "Bring it over (migration mode)". Then open the app's page, or the "Migration" command in the terminal.

commented

I merged main into the branch and pushed.

There was one conflict, in src/tui/screens/workspace.ts, at the icsTable signature. main had changed it to return { table, unread }, and my side only differed by a comment rewrap, so I kept main's version. My migrationCommands entry in the same file merged without conflict.

After the merge:

  • bun scripts/gate.ts --fix rewrapped nothing and bun x tsc --noEmit is clean. I regenerated the docs/MCP.md tool table with bun scripts/mcp-table.ts and it left nothing to commit.
  • The five migration tests (mcp-table, migration-doors, migration-mode, mcp-migrate, mcp-apps-migration) pass (27 tests).
  • I did not run the full suite; the forge's check will.
commented

Two of the four failing checks were this pull's own, and I've fixed both and pushed. The other two are the MCP-doc test, which also fails on main. I re-ran the two fixed test files locally (7 tests pass) and bun x tsc --noEmit is clean. I did not re-run the MCP-doc test after the fix, and scripts/gate.ts --fix printed nothing.

  • Orphan note and index row: docs/features/migration-mode.md had no row in docs/features/README.md. That broke "no feature note is an orphan" and the index-count test. I added the row under "What a forge is", next to "Milestones at the front door".
  • Dead export: migrationOrigin in src/apps/migration_mode.ts is called only from tests (test/migrate.test.ts, test/mcp-migrate.test.ts). I added it to scripts/unused-exports-allow.json rather than delete it, since the tests use it to check where an origin is kept.
  • MCP doc test: "every tool's doc names each argument" fails because the explore tool's doc omits its mine argument. The check log says it is red on main at 3dfc394 too, and I left it alone.

The unused-exports test also prints a "no longer dead" list of entries in the allow-list that now have callers. That is a warning, not a failure, and I left it.

commented

Left #644 open: 2 unticked items remain (Selectable at spawn time next to "fork of mine" and "autonomous" (#M6 carries it in the config).; Minimal, not bare: one primary next action; looks of the path at phone and desktop widths on the pull.).

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs