I fabricated a syntax error in the config file (missing comma after the "600"):
...
agent-config: |
{
"command_timeout": 600
"allowed_commands": [
"wc -l*"
]
...
I would expect it to tell me that a comma is missing at line $X. Instead, I am getting this stack trace:
Traceback (most recent call last):
File "/Users/me/Documents/src/cecli-fork/cecli/coders/agent_coder.py", line 144, in _get_agent_config
config = json.loads(self.args.agent_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/decoder.py", line 338, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/decoder.py", line 354, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 3 column 3 (char 29)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/me/.local/bin/cecli", line 8, in <module>
sys.exit(main())
^^^^^^
File "/Users/me/Documents/src/cecli-fork/cecli/main.py", line 494, in main
return asyncio.run(main_async(argv, input, output, force_git_root, return_coder))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/me/Documents/src/cecli-fork/cecli/main.py", line 1035, in main_async
coder = await Coder.create(
^^^^^^^^^^^^^^^^^^^
File "/Users/me/Documents/src/cecli-fork/cecli/coders/base_coder.py", line 338, in create
res = coder(main_model, io, args=args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/me/Documents/src/cecli-fork/cecli/coders/agent_coder.py", line 99, in __init__
self.agent_config = self._get_agent_config()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/me/Documents/src/cecli-fork/cecli/coders/agent_coder.py", line 146, in _get_agent_config
self.io.tool_warning(f"Failed to parse agent-config JSON: {e}")
^^^^^^^
AttributeError: 'AgentCoder' object has no attribute 'io'
Note how the user-facing error message is helpfully included in the middle (json.decoder.JSONDecodeError: Expecting ',' delimiter: line 3 column 3 (char 29)) so it should be reasonably easy to display that instead of the stack trace.
Note how this is the sub-parsing of the embedded JSON for the agent-config parameter. Syntax errors in the top-level YAML are reported correctly - breaking that, I get something like this:
cecli: error: Couldn't parse config file: while scanning a simple key
in "/Users/me/.cecli.conf.yml", line 79, column 9
could not find expected ':'
in "/Users/me/.cecli.conf.yml", line 81, column 1
Thanks for the awesome development!
cecli v0.100.6.dev8
I fabricated a syntax error in the config file (missing comma after the "600"):
I would expect it to tell me that a comma is missing at line $X. Instead, I am getting this stack trace:
Note how the user-facing error message is helpfully included in the middle (
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 3 column 3 (char 29)) so it should be reasonably easy to display that instead of the stack trace.Note how this is the sub-parsing of the embedded JSON for the
agent-configparameter. Syntax errors in the top-level YAML are reported correctly - breaking that, I get something like this:Thanks for the awesome development!
cecli v0.100.6.dev8