Skip to content

Commit e65f5ee

Browse files
Refactor config access around an Ecto schema
#### Context The config layer had grown around NimbleOptions and a large getter surface. This branch moves parsing to an Ecto schema and simplifies callers to read typed nested settings directly. #### TL;DR *Replace the bespoke config access layer with an Ecto-backed schema and typed settings access.* #### Summary - Replace the old config extraction path with an Ecto embedded schema and defaults - Collapse `Config` down to `settings/0`, `settings!/0`, and a small runtime helper surface - Update callers and tests to read nested config structs directly instead of one-off getter wrappers - Keep the repo green under format, lint, coverage, and dialyzer by adding the missing schema specs and tests #### Alternatives - Keep NimbleOptions and shrink the wrapper layer incrementally, but that would preserve the custom parser shape - Keep the strict refactor without extra schema tests, but that left `make -C elixir all` red on coverage and dialyzer #### Test Plan - [x] `make -C elixir all` - [x] `cd elixir && mix test test/symphony_elixir/workspace_and_config_test.exs --warnings-as-errors`
1 parent b0e0ff0 commit e65f5ee

16 files changed

Lines changed: 823 additions & 995 deletions

File tree

elixir/lib/symphony_elixir/agent_runner.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ defmodule SymphonyElixir.AgentRunner do
4747
defp send_codex_update(_recipient, _issue, _message), do: :ok
4848

4949
defp run_codex_turns(workspace, issue, codex_update_recipient, opts) do
50-
max_turns = Keyword.get(opts, :max_turns, Config.agent_max_turns())
50+
max_turns = Keyword.get(opts, :max_turns, Config.settings!().agent.max_turns)
5151
issue_state_fetcher = Keyword.get(opts, :issue_state_fetcher, &Tracker.fetch_issue_states_by_ids/1)
5252

5353
with {:ok, session} <- AppServer.start_session(workspace) do
@@ -136,7 +136,7 @@ defmodule SymphonyElixir.AgentRunner do
136136
defp active_issue_state?(state_name) when is_binary(state_name) do
137137
normalized_state = normalize_issue_state(state_name)
138138

139-
Config.linear_active_states()
139+
Config.settings!().tracker.active_states
140140
|> Enum.any?(fn active_state -> normalize_issue_state(active_state) == normalized_state end)
141141
end
142142

elixir/lib/symphony_elixir/codex/app_server.ex

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ defmodule SymphonyElixir.Codex.AppServer do
143143

144144
defp validate_workspace_cwd(workspace) when is_binary(workspace) do
145145
workspace_path = Path.expand(workspace)
146-
workspace_root = Path.expand(Config.workspace_root())
146+
workspace_root = Path.expand(Config.settings!().workspace.root)
147147

148148
root_prefix = workspace_root <> "/"
149149

@@ -172,7 +172,7 @@ defmodule SymphonyElixir.Codex.AppServer do
172172
:binary,
173173
:exit_status,
174174
:stderr_to_stdout,
175-
args: [~c"-lc", String.to_charlist(Config.codex_command())],
175+
args: [~c"-lc", String.to_charlist(Config.settings!().codex.command)],
176176
cd: String.to_charlist(workspace),
177177
line: @port_line_bytes
178178
]
@@ -277,7 +277,14 @@ defmodule SymphonyElixir.Codex.AppServer do
277277
end
278278

279279
defp await_turn_completion(port, on_message, tool_executor, auto_approve_requests) do
280-
receive_loop(port, on_message, Config.codex_turn_timeout_ms(), "", tool_executor, auto_approve_requests)
280+
receive_loop(
281+
port,
282+
on_message,
283+
Config.settings!().codex.turn_timeout_ms,
284+
"",
285+
tool_executor,
286+
auto_approve_requests
287+
)
281288
end
282289

283290
defp receive_loop(port, on_message, timeout_ms, pending_line, tool_executor, auto_approve_requests) do
@@ -820,7 +827,7 @@ defmodule SymphonyElixir.Codex.AppServer do
820827
end
821828

822829
defp await_response(port, request_id) do
823-
with_timeout_response(port, request_id, Config.codex_read_timeout_ms(), "")
830+
with_timeout_response(port, request_id, Config.settings!().codex.read_timeout_ms, "")
824831
end
825832

826833
defp with_timeout_response(port, request_id, timeout_ms, pending_line) do

0 commit comments

Comments
 (0)