fix(config): validate TOML files and base URLs - #194
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3f88ba05f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| hostname = parsed.hostname | ||
| parsed.port # Accessing .port validates non-numeric and out-of-range ports. | ||
| except ValueError as exc: | ||
| raise ConfigWizardError( | ||
| f"Base URL must be an absolute http(s) URL with a valid hostname and port, got: {url!r}" | ||
| ) from exc | ||
| if parsed.scheme not in ("http", "https") or not hostname: |
There was a problem hiding this comment.
Validate hostname syntax before accepting base URLs
For inputs like https://exa mple.com or https://_bad, urlparse(...).hostname still returns a non-empty string, so this check accepts and saves base URLs that common HTTP/URL clients reject later. Since this path is intended to validate hostnames before writing TOML/OpenCode config, add an explicit hostname/IP validation step rather than treating any non-empty parsed hostname as valid.
Useful? React with 👍 / 👎.
DescriptionThis PR fixes three configuration-handling issues in The implementation keeps the existing format-preserving TOML editor and changes only the validation and key-matching logic required for these cases. Modification approach
The current behavior treats |
Summary
Fix LLM configuration handling for empty TOML files, quoted TOML keys, and invalid base URL ports.
Changes
fm-agent.tomlfiles to be initialized.