Add gateway CLI for storing config in database#7227
Merged
Conversation
61ea67b to
6e9d3b0
Compare
dcd7e6e to
1c2d757
Compare
6e9d3b0 to
419dd7f
Compare
1c2d757 to
0d660a3
Compare
419dd7f to
9bedcbf
Compare
0d660a3 to
4fe7a14
Compare
9bedcbf to
26709c0
Compare
26709c0 to
70b3dca
Compare
4fe7a14 to
e2c6dee
Compare
66901b7 to
b0f17d7
Compare
e2c6dee to
86b4541
Compare
b0f17d7 to
a85514b
Compare
85beeb8 to
fdc9aa1
Compare
86b4541 to
738154a
Compare
738154a to
e8b6282
Compare
fdc9aa1 to
9888492
Compare
e8b6282 to
edab501
Compare
95ea677 to
60adc3e
Compare
085ab56 to
533b3be
Compare
15f76cb to
5dc6d5b
Compare
63dbb2d to
5ec24e8
Compare
Contributor
Author
|
@BugBot review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Directory path prefix stripping breaks filesystem template access
- Modified ResolveRelativePathsVisitor::visit_leaf to skip prefix stripping for directory paths, ensuring they remain absolute as documented.
Or push these changes by commenting:
@cursor push d05ef536a6
Preview (d05ef536a6)
diff --git a/crates/tensorzero-core/src/config/path.rs b/crates/tensorzero-core/src/config/path.rs
--- a/crates/tensorzero-core/src/config/path.rs
+++ b/crates/tensorzero-core/src/config/path.rs
@@ -358,10 +358,15 @@
let resolved_path =
resolve_target_path(self.span_map, span, target_string.as_ref(), error_path)?;
- let remapped_path = self
- .shared_path_prefix_to_strip
- .and_then(|prefix| resolved_path.strip_prefix(prefix).ok())
- .unwrap_or(resolved_path.as_path());
+
+ let is_directory = resolved_path.is_dir();
+ let remapped_path = if is_directory {
+ resolved_path.as_path()
+ } else {
+ self.shared_path_prefix_to_strip
+ .and_then(|prefix| resolved_path.strip_prefix(prefix).ok())
+ .unwrap_or(resolved_path.as_path())
+ };
let remapped_path_str = path_to_utf8_string(remapped_path, error_path)?;
let mut inner_table = DeTable::new();
@@ -370,7 +375,7 @@
Spanned::new(0..0, DeValue::String(Cow::Owned(remapped_path_str))),
);
- if resolved_path.is_dir() {
+ if is_directory {
if !is_directory_path(error_path) {
return Err(Error::new(ErrorDetails::Config {
message: format!(This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Aaron1011
reviewed
Apr 13, 2026
Contributor
Author
|
@BugBot review |
Aaron1011
previously approved these changes
Apr 13, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5882069. Configure here.
5882069 to
04e60b5
Compare
04e60b5 to
fc53808
Compare
Aaron1011
previously approved these changes
Apr 13, 2026
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.


Fixes #7128.
Fixes #7122.
This gives us e2e flow for enabling config-in-db for a running gateway. Next up we will wire up the UI to edit live configs, and also add e2e tests.
The breakdown is:
We can iterate on the exact API options here (we can deprecate --config-file too) but for now this means existing users don't see any differences and new users can get config-in-db with minimal changes once we flip the flag.
Note
Medium Risk
Adds a new CLI workflow that writes parsed/validated configuration and templates into Postgres, plus changes how template file paths are normalized; mistakes here could lead to incorrect stored template keys or failed startups when switching to config-in-DB.
Overview
Adds a new gateway early-exit CLI command,
--store-config, which reads a config glob, validates it, and persists the resulting config (plus any discovered extra templates) into Postgres viawrite_stored_config.Refactors startup config loading to reuse a shared
load_config_from_path_globhelper and blocks--store-configwhengateway.template_filesystem_accessis active.Changes TOML path resolution so file-backed template keys are stored as paths relative to the shared directory prefix (while directory paths like
gateway.template_filesystem_access.base_pathremain absolute), updating related DB write plumbing and tests accordingly.Reviewed by Cursor Bugbot for commit 5882069. Bugbot is set up for automated code reviews on this repo. Configure here.