Skip to content

fix: global migrations#117

Closed
pedronauck wants to merge 13 commits into
mainfrom
fix-migrations
Closed

fix: global migrations#117
pedronauck wants to merge 13 commits into
mainfrom
fix-migrations

Conversation

@pedronauck
Copy link
Copy Markdown
Member

@pedronauck pedronauck commented May 7, 2026

Summary by CodeRabbit

  • New Features

    • Added a model catalog (provider model listing, refresh, status) with both native and OpenAI-compatible endpoints.
    • Session creation now accepts model and reasoning-effort overrides; ACP sessions surface config options and reasoning effort.
    • CLI gained provider model commands (list/refresh/status).
    • Database migrations add task orchestration profiles, review gates, notification cursors, and bridge task subscriptions.
  • Tests

    • Migration-order/assertion helpers and append-only migration contract checks added across tests.

@pedronauck pedronauck self-assigned this May 7, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agh-site Error Error May 7, 2026 3:33pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 343ca8e0-63aa-43f8-9c06-6d834cf7642f

📥 Commits

Reviewing files that changed from the base of the PR and between bfd5485 and fbafcb5.

⛔ Files ignored due to path filters (64)
  • .compozy/tasks/provider-model-catalog/analysis/acp-sdk-breaking-changes.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/issues/BUG-NNN-template.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/SMOKE-001.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-001.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-002.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-003.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-004.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-005.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-006.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-007.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-008.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-009.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-010.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-011.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-012.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-013.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-014.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-FUNC-015.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-INT-001.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-INT-002.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-INT-003.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-INT-004.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-INT-005.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-INT-006.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-PERF-001.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-PERF-002.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-REG-001.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-REG-002.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-SCEN-001.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-SCEN-002.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-SEC-001.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-SEC-002.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-UI-001.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-UI-002.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-cases/TC-UI-003.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-plans/00-coverage-matrix.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-plans/provider-model-catalog-regression.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/test-plans/provider-model-catalog-test-plan.md is excluded by !**/*.md
  • .compozy/tasks/provider-model-catalog/qa/verification-report-template.md is excluded by !**/*.md
  • config.toml is excluded by !**/*.toml
  • go.sum is excluded by !**/*.sum, !**/*.sum
  • internal/testutil/acpmock/testdata/browser_session_lifecycle_fixture.json is excluded by !**/*.json
  • openapi/agh.json is excluded by !**/*.json
  • packages/site/content/runtime/api-reference/meta.json is excluded by !**/*.json
  • packages/site/content/runtime/cli-reference/memory/extractor/replay.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/memory/reset.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/provider/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/provider/meta.json is excluded by !**/*.json
  • packages/site/content/runtime/cli-reference/provider/models/index.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/provider/models/list.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/provider/models/meta.json is excluded by !**/*.json
  • packages/site/content/runtime/cli-reference/provider/models/refresh.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/provider/models/status.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/cli-reference/session/new.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/agents/definitions.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/agents/meta.json is excluded by !**/*.json
  • packages/site/content/runtime/core/agents/model-catalog.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/agents/providers.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/configuration/agent-md.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/configuration/config-toml.mdx is excluded by !**/*.mdx
  • packages/site/content/runtime/core/extensions/develop.mdx is excluded by !**/*.mdx
  • sdk/typescript/src/generated/contracts.ts is excluded by !**/generated/**
  • web/e2e/fixtures/__tests__/runtime-seed.test.ts is excluded by !**/fixtures/**
  • web/src/generated/agh-openapi.d.ts is excluded by !**/generated/**
📒 Files selected for processing (181)
  • go.mod
  • internal/acp/client.go
  • internal/acp/client_test.go
  • internal/acp/config_options.go
  • internal/acp/config_options_test.go
  • internal/acp/handlers.go
  • internal/acp/handlers_test.go
  • internal/acp/permission.go
  • internal/acp/process_tree_test.go
  • internal/acp/types.go
  • internal/acp/types_test.go
  • internal/api/contract/contract.go
  • internal/api/contract/contract_test.go
  • internal/api/contract/settings.go
  • internal/api/core/conversions.go
  • internal/api/core/conversions_parsers_test.go
  • internal/api/core/errors.go
  • internal/api/core/handlers.go
  • internal/api/core/interfaces.go
  • internal/api/core/memory_workspace_test.go
  • internal/api/core/model_catalog.go
  • internal/api/core/model_catalog_conversions.go
  • internal/api/core/model_catalog_test.go
  • internal/api/core/session_workspace.go
  • internal/api/core/session_workspace_internal_test.go
  • internal/api/core/settings.go
  • internal/api/core/settings_internal_test.go
  • internal/api/core/settings_test.go
  • internal/api/core/workspaces.go
  • internal/api/httpapi/handlers.go
  • internal/api/httpapi/handlers_test.go
  • internal/api/httpapi/middleware.go
  • internal/api/httpapi/model_catalog_test.go
  • internal/api/httpapi/routes.go
  • internal/api/httpapi/server.go
  • internal/api/httpapi/transport_parity_integration_test.go
  • internal/api/spec/model_catalog.go
  • internal/api/spec/spec.go
  • internal/api/spec/spec_test.go
  • internal/api/testutil/model_catalog_parity_test.go
  • internal/api/udsapi/handlers_test.go
  • internal/api/udsapi/model_catalog_test.go
  • internal/api/udsapi/routes.go
  • internal/api/udsapi/server.go
  • internal/api/udsapi/transport_parity_integration_test.go
  • internal/cli/client.go
  • internal/cli/client_provider_models.go
  • internal/cli/config.go
  • internal/cli/config_test.go
  • internal/cli/helpers_test.go
  • internal/cli/install.go
  • internal/cli/install_test.go
  • internal/cli/provider.go
  • internal/cli/provider_models.go
  • internal/cli/provider_models_test.go
  • internal/cli/session.go
  • internal/config/autonomy.go
  • internal/config/autonomy_test.go
  • internal/config/bootstrap.go
  • internal/config/bootstrap_test.go
  • internal/config/config.go
  • internal/config/config_test.go
  • internal/config/merge.go
  • internal/config/perf_bench_test.go
  • internal/config/persistence_test.go
  • internal/config/provider.go
  • internal/config/provider_test.go
  • internal/config/tool_surface.go
  • internal/daemon/boot.go
  • internal/daemon/daemon.go
  • internal/daemon/daemon_integration_test.go
  • internal/daemon/daemon_nightly_combined_integration_test.go
  • internal/daemon/daemon_sandbox_integration_test.go
  • internal/daemon/model_catalog.go
  • internal/daemon/model_catalog_test.go
  • internal/daemon/tool_approval_bridge.go
  • internal/extension/capability.go
  • internal/extension/capability_models_test.go
  • internal/extension/contract/host_api.go
  • internal/extension/contract/sdk.go
  • internal/extension/host_api.go
  • internal/extension/host_api_models.go
  • internal/extension/host_api_models_test.go
  • internal/extension/manager_model_source_test.go
  • internal/extension/manager_test.go
  • internal/extension/manifest.go
  • internal/extension/manifest_model_source_test.go
  • internal/extension/model_source.go
  • internal/extension/model_source_test.go
  • internal/extension/protocol/host_api.go
  • internal/extension/protocol/host_api_test.go
  • internal/extension/tool_runtime.go
  • internal/modelcatalog/errors.go
  • internal/modelcatalog/hardcut_residue_test.go
  • internal/modelcatalog/live_sources.go
  • internal/modelcatalog/live_sources_test.go
  • internal/modelcatalog/merge.go
  • internal/modelcatalog/modelsdev.go
  • internal/modelcatalog/modelsdev_test.go
  • internal/modelcatalog/redact.go
  • internal/modelcatalog/redact_test.go
  • internal/modelcatalog/service.go
  • internal/modelcatalog/service_integration_test.go
  • internal/modelcatalog/service_test.go
  • internal/modelcatalog/source_id.go
  • internal/modelcatalog/sources.go
  • internal/modelcatalog/sources_test.go
  • internal/modelcatalog/types.go
  • internal/sandbox/daytona/provider_test.go
  • internal/session/interfaces.go
  • internal/session/manager.go
  • internal/session/manager_start.go
  • internal/session/manager_test.go
  • internal/session/query.go
  • internal/session/query_test.go
  • internal/session/runtime_overrides.go
  • internal/session/session.go
  • internal/settings/collections.go
  • internal/settings/models.go
  • internal/settings/service_test.go
  • internal/situation/service.go
  • internal/store/globaldb/global_db.go
  • internal/store/globaldb/global_db_model_catalog.go
  • internal/store/globaldb/global_db_model_catalog_test.go
  • internal/store/globaldb/global_db_test.go
  • internal/store/globaldb/migrate_model_catalog.go
  • internal/store/globaldb/schema_model_catalog.go
  • internal/store/types.go
  • internal/testutil/acpmock/cmd/acpmock-driver/main.go
  • internal/testutil/acpmock/cmd/acpmock-driver/main_test.go
  • internal/testutil/acpmock/fixture.go
  • internal/testutil/e2e/config_seed_test.go
  • internal/testutil/e2e/runtime_harness_integration_test.go
  • internal/workspace/clone.go
  • internal/workspace/resolver_test.go
  • magefile.go
  • packages/site/lib/__tests__/provider-model-catalog-docs.test.ts
  • packages/site/lib/__tests__/runtime-manual-api-routes.test.ts
  • packages/site/lib/runtime-navigation.ts
  • packages/site/scripts/generate-openapi.ts
  • packages/ui/src/components/metric.tsx
  • web/e2e/__tests__/session-provider-override.spec.ts
  • web/src/hooks/routes/__tests__/use-app-layout.test.tsx
  • web/src/hooks/routes/__tests__/use-settings-providers-page.test.tsx
  • web/src/hooks/routes/use-settings-providers-page.ts
  • web/src/routes/_app.tsx
  • web/src/routes/_app/settings/__tests__/-providers.test.tsx
  • web/src/routes/_app/settings/providers.tsx
  • web/src/systems/agent/components/agent-sessions-list.tsx
  • web/src/systems/automation/components/automation-run-history.tsx
  • web/src/systems/knowledge/components/knowledge-delete-dialog.tsx
  • web/src/systems/knowledge/components/knowledge-edit-dialog.tsx
  • web/src/systems/model-catalog/__tests__/derive-active-session-options.test.ts
  • web/src/systems/model-catalog/adapters/model-catalog-api.ts
  • web/src/systems/model-catalog/hooks/use-provider-models.ts
  • web/src/systems/model-catalog/hooks/use-refresh-provider-models.ts
  • web/src/systems/model-catalog/index.ts
  • web/src/systems/model-catalog/lib/derive-active-session-options.ts
  • web/src/systems/model-catalog/lib/query-keys.ts
  • web/src/systems/model-catalog/lib/query-options.ts
  • web/src/systems/model-catalog/types.ts
  • web/src/systems/network/components/shell/inspector-activity-feed.tsx
  • web/src/systems/network/components/shell/inspector-members-list.tsx
  • web/src/systems/network/components/work/work-inspector.tsx
  • web/src/systems/session/components/__tests__/session-create-dialog.test.tsx
  • web/src/systems/session/components/model-command-select.tsx
  • web/src/systems/session/components/reasoning-command-select.tsx
  • web/src/systems/session/components/session-create-dialog.tsx
  • web/src/systems/session/hooks/__tests__/use-session-create-dialog.test.tsx
  • web/src/systems/session/hooks/use-session-create-dialog.ts
  • web/src/systems/settings/adapters/__tests__/settings-api.test.ts
  • web/src/systems/settings/components/index.ts
  • web/src/systems/settings/components/provider-card.tsx
  • web/src/systems/settings/components/provider-model-catalog-status.tsx
  • web/src/systems/settings/components/settings-page-shell.tsx
  • web/src/systems/settings/mocks/fixtures.ts
  • web/src/systems/skill/components/skill-detail-panel.tsx
  • web/src/systems/workspace/components/provider-command-list.tsx
  • web/src/systems/workspace/components/provider-command-select.tsx
  • web/src/systems/workspace/index.ts
  • web/src/systems/workspace/mocks/fixtures.ts

Walkthrough

This PR adds a model-catalog subsystem (types, sources, service, merge, redaction), extends ACP with session config-options and reasoning-effort handling, expands API/extension/CLI surfaces for provider model listing/refresh/status, wires the model catalog into daemon boot/runtime and servers, replaces ProviderConfig.DefaultModel with a nested Models block, and inserts/reorders global DB migrations plus tests that validate migration ordering and an append-only migration contract.

Changes

Schema Migrations and Validation

Layer / File(s) Summary
Core Migration Definitions
internal/store/globaldb/global_db.go
Five new migrations are inserted into globalSchemaMigrations so orchestration/profile, review gate, notification cursors, bridge task subscriptions, and network conversation rebuild migrations appear before the later memv2 migration; ordering numbers shifted accordingly.
Migration Contract and Helpers
internal/store/globaldb/global_db_test.go
Adds TestGlobalSchemaMigrationsAreAppendOnlyContract and helper types/functions to assert expected migration identities (version, name, checksum) and to compare in-code migration definitions with persisted schema_migrations records.
Test Refactoring
internal/store/globaldb/global_db_heartbeat_test.go, internal/store/globaldb/global_db_soul_test.go
Simplifies per-index migration assertions by calling assertAppliedGlobalMigrationOrder to validate the full applied migration ordering in tests.
Network Migration Version and Test Expansion
internal/store/globaldb/global_db_network_conversations_test.go
Bumps network conversation migration version constant to reflect reordered migrations and expands the reopen/upgrade test to snapshot and verify applied migration ordering and stability of prior AppliedAt timestamps across reopen.

(See walkthrough above for full feature summary.)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Medium-high scope: many new packages and public types, runtime wiring, and broad test additions/updates. Focus review on modelcatalog types/service correctness, live discovery security (secret resolution and redaction), ACP config-option handling and capability snapshots, API/handler parameter validation and OpenAI error shaping, provider config merge/validation, and DB migration ordering/tests.

Possibly related PRs

  • compozy/agh#108 — Also adjusts global DB migration ordering and inserts migrations near memv2 work.
  • compozy/agh#66 — Prior migration-order changes touching internal/store/globaldb/global_db.go.
  • compozy/agh#82 — Related ACP changes affecting internal/acp client/session wiring and tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/store/globaldb/global_db.go (1)

849-876: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Keep memv2_memory_events at its shipped version.

This reorders recorded history by moving memv2_memory_events behind new entries. Any database that already applied version 18 as memv2_memory_events will now fail reopen with a migration integrity mismatch when version 18 is checked against add_task_review_gate_schema. These new migrations need to be appended after the existing tail, not inserted ahead of it.

Suggested fix
 	{
-		Version:  18,
-		Name:     "add_task_review_gate_schema",
-		Up:       migrateTaskReviewGateSchema,
-		Checksum: "2026-05-05-add-task-review-gate-schema",
+		Version:  18,
+		Name:     "memv2_memory_events",
+		Up:       migrateMemoryV2Events,
+		Checksum: "2026-05-05-memv2-memory-events",
 	},
 	{
-		Version:  19,
-		Name:     "add_notification_cursors",
-		Up:       migrateNotificationCursors,
-		Checksum: "2026-05-05-add-notification-cursors",
+		Version:  19,
+		Name:     "add_task_review_gate_schema",
+		Up:       migrateTaskReviewGateSchema,
+		Checksum: "2026-05-05-add-task-review-gate-schema",
 	},
 	{
-		Version:  20,
-		Name:     "add_bridge_task_subscriptions",
-		Up:       migrateBridgeTaskSubscriptions,
-		Checksum: "2026-05-05-add-bridge-task-subscriptions",
+		Version:  20,
+		Name:     "add_notification_cursors",
+		Up:       migrateNotificationCursors,
+		Checksum: "2026-05-05-add-notification-cursors",
 	},
 	{
-		Version:  21,
-		Name:     "rebuild_network_conversation_containers",
-		Up:       migrateNetworkConversationContainers,
-		Checksum: "2026-05-05-rebuild-network-conversation-containers",
+		Version:  21,
+		Name:     "add_bridge_task_subscriptions",
+		Up:       migrateBridgeTaskSubscriptions,
+		Checksum: "2026-05-05-add-bridge-task-subscriptions",
 	},
 	{
-		Version:  22,
-		Name:     "memv2_memory_events",
-		Up:       migrateMemoryV2Events,
-		Checksum: "2026-05-05-memv2-memory-events",
+		Version:  22,
+		Name:     "rebuild_network_conversation_containers",
+		Up:       migrateNetworkConversationContainers,
+		Checksum: "2026-05-05-rebuild-network-conversation-containers",
 	},

As per coding guidelines: "SQLite migration registries are append-only. Never insert, reorder, rename, renumber, or change an existing migration identity after it may have been applied."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/store/globaldb/global_db.go` around lines 849 - 876, The migration
list has reordered the existing "memv2_memory_events" migration
(migrateMemoryV2Events) from its shipped Version 18, causing integrity
mismatches; restore memv2_memory_events to its original Version 18 position and
append the new migrations (migrateTaskReviewGateSchema,
migrateNotificationCursors, migrateBridgeTaskSubscriptions,
migrateNetworkConversationContainers) after the current tail so no existing
migration identity (name/Version/Checksum) is moved or renumbered; update the
Version values for the newly appended migrations so they follow the highest
existing Version number instead of inserting before memv2_memory_events.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/store/globaldb/global_db_test.go`:
- Around line 245-358: The test currently asserts the full migration list
(expectedGlobalMigrationIdentities) equals globalSchemaMigrations which was
reordered in this PR; instead change the test to pin only the historically
shipped prefix and allow new migrations to be appended: update
expectedGlobalMigrationIdentities (or replace it with
expectedGlobalMigrationPrefix) to reflect the last shipped identities (the
original versions/names/checksums that were released), modify
assertGlobalSchemaMigrationDefinitions and assertAppliedGlobalMigrationOrder to
check that the first N entries match that pinned prefix (comparing
Version/Name/Checksum) and that any additional migrations are simply appended
(i.e., lengths may be >= prefix length), and add/adjust tests in
TestGlobalSchemaMigrationsAreAppendOnlyContract to cover fresh DB,
upgrade/reopen, and the recorded-prefix scenario using the pinned prefix helper.

---

Outside diff comments:
In `@internal/store/globaldb/global_db.go`:
- Around line 849-876: The migration list has reordered the existing
"memv2_memory_events" migration (migrateMemoryV2Events) from its shipped Version
18, causing integrity mismatches; restore memv2_memory_events to its original
Version 18 position and append the new migrations (migrateTaskReviewGateSchema,
migrateNotificationCursors, migrateBridgeTaskSubscriptions,
migrateNetworkConversationContainers) after the current tail so no existing
migration identity (name/Version/Checksum) is moved or renumbered; update the
Version values for the newly appended migrations so they follow the highest
existing Version number instead of inserting before memv2_memory_events.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 264a70a4-ca00-45da-8548-48a445739a1c

📥 Commits

Reviewing files that changed from the base of the PR and between 37e8236 and bfd5485.

⛔ Files ignored due to path filters (8)
  • .codex/ledger/2026-05-06-MEMORY-sqlite-migration-drift.md is excluded by !**/*.md
  • .codex/plans/2026-05-06-sqlite-migration-append-only.md is excluded by !**/*.md
  • AGENTS.md is excluded by !**/*.md
  • CLAUDE.md is excluded by !**/*.md
  • docs/_memory/lessons/L-021-schema-migration-identity-is-append-only.md is excluded by !**/*.md
  • docs/_memory/lessons/README.md is excluded by !**/*.md
  • internal/AGENTS.md is excluded by !**/*.md
  • internal/CLAUDE.md is excluded by !**/*.md
📒 Files selected for processing (5)
  • internal/store/globaldb/global_db.go
  • internal/store/globaldb/global_db_heartbeat_test.go
  • internal/store/globaldb/global_db_network_conversations_test.go
  • internal/store/globaldb/global_db_soul_test.go
  • internal/store/globaldb/global_db_test.go

Comment on lines +245 to +358
func TestGlobalSchemaMigrationsAreAppendOnlyContract(t *testing.T) {
t.Parallel()

t.Run("Should keep known migration identities stable", func(t *testing.T) {
t.Parallel()

assertGlobalSchemaMigrationDefinitions(t, globalSchemaMigrations)
})
}

type expectedGlobalMigrationIdentity struct {
version int
name string
checksum string
}

func expectedGlobalMigrationIdentities() []expectedGlobalMigrationIdentity {
return []expectedGlobalMigrationIdentity{
{
version: 1,
name: "create_global_schema",
checksum: "70e2c16c9d32e692891ab71d075ca823782626e7c9f6ffbbc88c5d662704e089",
},
{version: 2, name: "add_session_failure_diagnostics", checksum: "2026-04-24-add-session-failure-diagnostics"},
{version: 3, name: "add_automation_scheduler_state", checksum: "2026-04-24-add-automation-scheduler-state"},
{version: 4, name: "add_mcp_auth_tokens", checksum: "2026-04-25-add-mcp-auth-tokens"},
{version: 5, name: "add_tool_process_records", checksum: "2026-04-24-add-tool-process-records"},
{version: 6, name: "add_memory_operation_scope", checksum: "2026-04-25-add-memory-operation-scope"},
{version: 7, name: "add_task_run_claim_lease_schema", checksum: "2026-04-26-add-task-run-claim-lease-schema"},
{version: 8, name: "add_session_lineage_metadata", checksum: "2026-04-26-add-session-lineage-metadata"},
{
version: 9,
name: "rename_environment_columns_to_sandbox",
checksum: "2026-04-28-rename-environment-columns-to-sandbox",
},
{version: 10, name: "add_vault_secrets", checksum: "2026-05-01-add-vault-secrets"},
{version: 11, name: "unify_secret_refs", checksum: "2026-05-01-unify-secret-refs"},
{version: 12, name: "add_agent_soul_snapshots", checksum: "2026-05-02-add-agent-soul-snapshots"},
{version: 13, name: "add_agent_heartbeat_storage", checksum: "2026-05-02-add-agent-heartbeat-storage"},
{version: 14, name: "add_event_summary_lineage", checksum: "2026-05-04-add-event-summary-lineage"},
{
version: 15,
name: "rebuild_event_summaries_for_global_payloads",
checksum: "2026-05-04-rebuild-event-summaries-for-global-payloads",
},
{
version: 16,
name: "rename_actor_ref_columns_to_actor_id",
checksum: "2026-05-04-rename-actor-ref-columns-to-actor-id",
},
{
version: 17,
name: "add_task_orchestration_profile_schema",
checksum: "2026-05-05-add-task-orchestration-profile-schema",
},
{version: 18, name: "add_task_review_gate_schema", checksum: "2026-05-05-add-task-review-gate-schema"},
{version: 19, name: "add_notification_cursors", checksum: "2026-05-05-add-notification-cursors"},
{version: 20, name: "add_bridge_task_subscriptions", checksum: "2026-05-05-add-bridge-task-subscriptions"},
{
version: 21,
name: "rebuild_network_conversation_containers",
checksum: "2026-05-05-rebuild-network-conversation-containers",
},
{version: 22, name: "memv2_memory_events", checksum: "2026-05-05-memv2-memory-events"},
}
}

func assertGlobalSchemaMigrationDefinitions(t *testing.T, migrations []store.Migration) {
t.Helper()

want := expectedGlobalMigrationIdentities()
if got := len(migrations); got != len(want) {
t.Fatalf("globalSchemaMigrations length = %d, want %d", got, len(want))
}
for index, expected := range want {
got := migrations[index]
if got.Version != expected.version || got.Name != expected.name || got.Checksum != expected.checksum {
t.Fatalf(
"globalSchemaMigrations[%d] = version %d name %q checksum %q, want version %d name %q checksum %q",
index,
got.Version,
got.Name,
got.Checksum,
expected.version,
expected.name,
expected.checksum,
)
}
}
}

func assertAppliedGlobalMigrationOrder(t *testing.T, records []store.MigrationRecord) {
t.Helper()

want := expectedGlobalMigrationIdentities()
if got := len(records); got != len(want) {
t.Fatalf("schema_migrations length = %d, want %d", got, len(want))
}
for index, expected := range want {
got := records[index]
if got.Version != expected.version || got.Name != expected.name || got.Checksum != expected.checksum {
t.Fatalf(
"schema_migrations[%d] = version %d name %q checksum %q, want version %d name %q checksum %q",
index,
got.Version,
got.Name,
got.Checksum,
expected.version,
expected.name,
expected.checksum,
)
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make this contract reflect the last shipped migration history, not the reordered list in this PR.

As written, the new expected identities bless version 18 as add_task_review_gate_schema and version 22 as memv2_memory_events, so the suite passes on fresh databases while missing the real upgrade break for databases that already recorded the old version 18 identity. This contract should pin the historical prefix that was already shipped, then assert that any new entries are appended after it.

As per coding guidelines: "Migration drift fixes require observed-history tests. Cover fresh DB, upgrade/reopen, and the real recorded migration prefix that failed."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/store/globaldb/global_db_test.go` around lines 245 - 358, The test
currently asserts the full migration list (expectedGlobalMigrationIdentities)
equals globalSchemaMigrations which was reordered in this PR; instead change the
test to pin only the historically shipped prefix and allow new migrations to be
appended: update expectedGlobalMigrationIdentities (or replace it with
expectedGlobalMigrationPrefix) to reflect the last shipped identities (the
original versions/names/checksums that were released), modify
assertGlobalSchemaMigrationDefinitions and assertAppliedGlobalMigrationOrder to
check that the first N entries match that pinned prefix (comparing
Version/Name/Checksum) and that any additional migrations are simply appended
(i.e., lengths may be >= prefix length), and add/adjust tests in
TestGlobalSchemaMigrationsAreAppendOnlyContract to cover fresh DB,
upgrade/reopen, and the recorded-prefix scenario using the pinned prefix helper.

pedronauck and others added 12 commits May 7, 2026 03:00
Adds a new web/src/systems/model-catalog/ system (adapters, query
keys/options, hooks, derive helper) and consumes daemon catalog rows
from the new-session dialog and Settings > Providers, with stale,
error, refresh, and ACP config-option precedence handled centrally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removes flat default_model/supported_models/supports_reasoning_effort claims
from provider/config/agent docs and documents the daemon-owned model catalog
(native HTTP/UDS endpoints, /api/openai/v1/models projection, refresh
lifetime/coalescing rules, extension model.source contract) plus the new
model_catalog and provider models.discovery config sections. Regenerates the
provider models CLI reference and ride-along cli-reference reformat output
from make codegen + make cli-docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the release-grade QA artifacts for the provider model catalog
program (Tasks 01-11) under .compozy/tasks/provider-model-catalog/qa/:
coverage matrix mapping every TechSpec safety invariant, ADR, task,
public surface and failure mode to concrete cases; master test plan
with charter, environment, entry/exit criteria, scenario contract and
verification commands; tiered regression suite; 33 concrete test cases
(SMOKE-001 + TC-FUNC-001..015 + TC-INT-001..006 + TC-PERF-001..002 +
TC-SEC-001..002 + TC-UI-001..003 + TC-REG-001..002 + TC-SCEN-001..002);
bug template; verification report template. Task 13 can execute the
plan from an isolated agh-qa-bootstrap lab without inventing scenarios.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant