Describe the bug
The same configuration key resolves to a different Python type depending on which source it comes
from.
src/config.py:
def command_line_to_dict(list):
for arg in list:
kv = arg.split("=", 1)
if len(kv) == 2:
dict[kv[0]] = kv[1] # always a string
else:
dict[kv[0]] = True # a bare argument becomes a bool
The config file goes through yaml.safe_load, so maxFeedback: 25000 yields the integer 25000,
while maxFeedback=25000 on the command line yields the string "25000". config_get_by_key
passes either through unchanged, and configure stores whatever it gets into the atomspace. Any
later arithmetic on the value then fails, because a string reaches the Prolog evaluator as a
symbol rather than a number.
Command-line overrides are documented in docs/reference-configuration.md ("This reads a
command-line override via argk (name=value …)"), with no restriction to string-valued keys, so
the two sources look interchangeable.
To Reproduce
- Start the agent with a numeric knob on the command line, for example
run.metta maxFeedback=25000.
- The boot aborts while evaluating the knob. On our deployment the line was
is/2: Arithmetic: 25000/0 is not a function — the Name/Arity form, i.e. the value had
become a symbol.
- Move the same value into
config/config.yaml and the boot succeeds.
A related case in the same function: a bare argument without = becomes Python True, so
maxFeedback typed without a value is accepted as a boolean rather than rejected as a missing
value.
Expected behavior
A key resolves to the same value whichever source supplies it, or the command line rejects values
it cannot represent.
Actual behavior
A numeric knob works from config.yaml and aborts the boot from the command line, with an error
that names the value but not the cause.
Possible fix
Coerce in one place — in command_line_to_dict or config_get_by_key, try int, then float,
and fall back to the string. That keeps string knobs untouched and makes the two sources agree.
If command-line overrides are meant to be string-only, documenting that in
reference-configuration.md would also close it.
Environment
Seen on our own deployment while moving knobs from the launch line into config.yaml. The code
path above is current main, and it sits in the configuration layer, so it is independent of OS,
provider and channel.
Describe the bug
The same configuration key resolves to a different Python type depending on which source it comes
from.
src/config.py:The config file goes through
yaml.safe_load, somaxFeedback: 25000yields the integer 25000,while
maxFeedback=25000on the command line yields the string"25000".config_get_by_keypasses either through unchanged, and
configurestores whatever it gets into the atomspace. Anylater arithmetic on the value then fails, because a string reaches the Prolog evaluator as a
symbol rather than a number.
Command-line overrides are documented in
docs/reference-configuration.md("This reads acommand-line override via
argk(name=value…)"), with no restriction to string-valued keys, sothe two sources look interchangeable.
To Reproduce
run.metta maxFeedback=25000.is/2: Arithmetic: 25000/0 is not a function— theName/Arityform, i.e. the value hadbecome a symbol.
config/config.yamland the boot succeeds.A related case in the same function: a bare argument without
=becomes PythonTrue, somaxFeedbacktyped without a value is accepted as a boolean rather than rejected as a missingvalue.
Expected behavior
A key resolves to the same value whichever source supplies it, or the command line rejects values
it cannot represent.
Actual behavior
A numeric knob works from
config.yamland aborts the boot from the command line, with an errorthat names the value but not the cause.
Possible fix
Coerce in one place — in
command_line_to_dictorconfig_get_by_key, tryint, thenfloat,and fall back to the string. That keeps string knobs untouched and makes the two sources agree.
If command-line overrides are meant to be string-only, documenting that in
reference-configuration.mdwould also close it.Environment
Seen on our own deployment while moving knobs from the launch line into
config.yaml. The codepath above is current
main, and it sits in the configuration layer, so it is independent of OS,provider and channel.