-
Notifications
You must be signed in to change notification settings - Fork 98
fix(ci,api-server): fix control-plane build context and migration parameter mismatch #1428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -42,32 +42,30 @@ func migration() *gormigrate.Migration { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func agentSchemaExpansionMigration() *gormigrate.Migration { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type Agent struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| db.Model | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ProjectId string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ParentAgentId *string `gorm:"index"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OwnerUserId *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Name string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DisplayName *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Prompt *string `gorm:"type:text"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RepoUrl *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WorkflowId *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LlmModel *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LlmTemperature *float64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LlmMaxTokens *int32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BotAccountName *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResourceOverrides *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EnvironmentVariables *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Labels *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Annotations *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CurrentSessionId *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return &gormigrate.Migration{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ID: "202604181000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Migrate: func(tx *gorm.DB) error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return tx.AutoMigrate(&Agent{}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stmts := []string{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS parent_agent_id TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS owner_user_id TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS display_name TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS description TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS repo_url TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS workflow_id TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS llm_model TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS llm_temperature DOUBLE PRECISION`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS llm_max_tokens INTEGER`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS bot_account_name TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS resource_overrides TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `ALTER TABLE agents ADD COLUMN IF NOT EXISTS environment_variables TEXT`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+48
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Model field nullability (non-pointer primitives expected non-null DB values):"
rg -n 'OwnerUserId|LlmModel|LlmTemperature|LlmMaxTokens' components/ambient-api-server/plugins/agents/model.go
echo
echo "Migration SQL currently defining these columns:"
rg -n 'owner_user_id|llm_model|llm_temperature|llm_max_tokens' components/ambient-api-server/plugins/agents/migration.goRepository: ambient-code/platform Length of output: 1082 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Checking for follow-up migrations after migration.go ==="
fd -e go migration | head -20
echo
echo "=== Checking if other fields have gorm NOT NULL constraints we missed ==="
rg -n 'gorm:"' components/ambient-api-server/plugins/agents/model.go | grep -E 'LlmModel|LlmTemperature|LlmMaxTokens|OwnerUserId'
echo
echo "=== Looking for any ALTER TABLE that adds NOT NULL to these columns ==="
rg -n 'ALTER TABLE agents' components/ambient-api-server/plugins/agents/ | grep -E 'owner_user_id|llm_model|llm_temperature|llm_max_tokens.*NOT NULL'Repository: ambient-code/platform Length of output: 1300 Add NOT NULL constraint to Line 50 creates Migration fix stmts := []string{
`ALTER TABLE agents ADD COLUMN IF NOT EXISTS parent_agent_id TEXT`,
- `ALTER TABLE agents ADD COLUMN IF NOT EXISTS owner_user_id TEXT`,
+ `ALTER TABLE agents ADD COLUMN IF NOT EXISTS owner_user_id TEXT NOT NULL DEFAULT ''`,
`ALTER TABLE agents ADD COLUMN IF NOT EXISTS display_name TEXT`,Consider applying similar constraints to 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `CREATE INDEX IF NOT EXISTS idx_agents_parent_agent_id ON agents(parent_agent_id)`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for _, s := range stmts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err := tx.Exec(s).Error; err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Rollback: func(tx *gorm.DB) error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cols := []string{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ambient-code/platform
Length of output: 439
Add
components/ambient-sdk/**to workflow path filtersThe Dockerfile for
ambient-control-planecopies fromambient-sdk/go-sdk/(lines 7–8 of the Dockerfile), but the workflow'son.push.pathsandon.pull_request.pathsdo not includecomponents/ambient-sdk/**. Changes to the SDK will not trigger a rebuild of this image.Add to both push and pull_request path filters
paths: - '.github/workflows/components-build-deploy.yml' - 'components/ambient-api-server/**' + - 'components/ambient-sdk/**' - 'components/ambient-control-plane/**'🤖 Prompt for AI Agents