Skip to content

ate-setup: refuse to point an external-database install at the bundled one - #2588

Merged
Dmitry Berkovich (dberkov) merged 2 commits into
agent-substrate:mainfrom
HavenXia:external-postgres-guard
Oct 13, 2026
Merged

Dmitry Berkovich (dberkov) merged 2 commits into
agent-substrate:mainfrom
HavenXia:external-postgres-guard

Conversation

@HavenXia

@HavenXia Haven Xia (HavenXia) commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

ate-setup doesn't remember an external PostgreSQL's connection string between runs.

The install record leaves it out intentionally because it can carry a password. If a run forgets ATE_API_POSTGRES_READ_WRITE_CONNECTION_STRING, ate-setup assumes the bundled database and writes its address into the API server's Secret:

  • deploy apiserver fails waiting for a bundled PostgreSQL that doesn't exist, and the next API server restart can't reach the database.
  • deploy ate-system starts an empty bundled PostgreSQL and moves the API server onto it, so every actor looks gone.

Now, if the run names no database and the Secret already holds an address that isn't the bundled one, ate-setup stops before it changes the database settings and names the missing variable.

A fresh installs, bundled installs and Cloud SQL work as before, and so does leaving Cloud SQL with an empty ATE_API_POSTGRES_CLOUDSQL_INSTANCE.

A second commit does the same for ATE_API_POSTGRES_OWNER_CONNECTION_STRING. If the install uses a separate owner login and a run gives only the read-write string, ate-setup stops instead of replacing the owner login.

Found while reviewing the upgrade runbook (#1844).
Part of #1686

  • Tests pass
  • Appropriate changes to documentation are included in the PR

@stshrive Steven Shriver (stshrive) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

This is an interesting edge case. Do all secret configurations potentially expose this same problem though?

An install on an external PostgreSQL can give ate-api-server a separate
owner login with ATE_API_POSTGRES_OWNER_CONNECTION_STRING. Like the
read-write string, the install record leaves it out, so every run has to
be given it again. A run that set only the read-write string used it for
the owner too, and silently replaced the owner login in the Secret.

ate-setup now stops in that case and names the missing variable.
Installs with one login are unchanged, and so are moves off the bundled
database, whose owner login is ate-setup's own.
@HavenXia

Copy link
Copy Markdown
Member Author

LGTM.

This is an interesting edge case. Do all secret configurations potentially expose this same problem though?

You are right, there's also ATE_API_POSTGRES_OWNER_CONNECTION_STRING which is paired with this.
The last one left out is ANTHROPIC_API_KEY but it doesn't have any issue like this.

@dberkov
Dmitry Berkovich (dberkov) added this pull request to the merge queue Oct 13, 2026
Merged via the queue into agent-substrate:main with commit d849b2a Oct 13, 2026
14 checks passed
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.

3 participants