Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(gitignore): cover agent.json and its YAML twins at the runtime root

Haozhe Wuc1122f7e1c7d
diff --git a/.gitignore b/.gitignore
index a890a7bdf..fb3169f9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,12 @@ agent/uploads/
# The per-broker config files below were missing until 2026-09-11 even though
# this comment already claimed them; agent/tests/test_gitignore_runtime_files.py
# now derives the filename constants from the code and fails on any gap.
+# The structured config (agent.json and its YAML twins) was missed the same
+# way until 2026-09-21: it holds IM channel credentials that the Feishu QR
+# login and the channel settings routes write here.
+/agent.json
+/agent.yaml
+/agent.yml
/sessions.db
/sessions.db-shm
/sessions.db-wal
diff --git a/agent/tests/test_gitignore_runtime_files.py b/agent/tests/test_gitignore_runtime_files.py
index e0b75ca7a..aee628bcc 100644
--- a/agent/tests/test_gitignore_runtime_files.py
+++ b/agent/tests/test_gitignore_runtime_files.py
@@ -17,6 +17,9 @@ from pathlib import Path
_AGENT_ROOT = Path(__file__).resolve().parents[1]
_REPO_ROOT = _AGENT_ROOT.parent
_FILENAME_CONSTANT = re.compile(r"(^|_)(CONFIG_FILENAME|DB_FILENAME)$")
+# A tuple of candidate names, e.g. ``paths._DEFAULT_FILENAMES`` for agent.json
+# and its YAML twins, which the single-name pattern above never saw.
+_FILENAMES_CONSTANT = re.compile(r"(^|_)FILENAMES$")
def _runtime_root_filenames() -> dict[str, str]:
@@ -30,13 +33,23 @@ def _runtime_root_filenames() -> dict[str, str]:
if not isinstance(node, ast.Assign) or len(node.targets) != 1:
continue
target = node.targets[0]
+ if not isinstance(target, ast.Name):
+ continue
+ module = str(path.relative_to(_REPO_ROOT))
if (
- isinstance(target, ast.Name)
- and _FILENAME_CONSTANT.search(target.id)
+ _FILENAME_CONSTANT.search(target.id)
and isinstance(node.value, ast.Constant)
and isinstance(node.value.value, str)
):
- found[node.value.value] = str(path.relative_to(_REPO_ROOT))
+ found[node.value.value] = module
+ elif _FILENAMES_CONSTANT.search(target.id) and isinstance(
+ node.value, (ast.Tuple, ast.List)
+ ):
+ for element in node.value.elts:
+ if isinstance(element, ast.Constant) and isinstance(
+ element.value, str
+ ):
+ found[element.value] = module
return found
@@ -50,7 +63,8 @@ def test_discovery_sees_the_broker_config_files() -> None:
names = _runtime_root_filenames()
assert {"alpaca.json", "zerodha.json", "connections.json"} <= set(names)
- assert len(names) >= 17
+ assert {"agent.json", "agent.yaml", "agent.yml"} <= set(names)
+ assert len(names) >= 20
def test_every_runtime_root_file_is_gitignored() -> None: