The nestif extraction in 651de0a pulled --provider parsing out of parseModelRest into extractProviderFlag, which took the modelParts slice by pointer and appended every non-provider field to it. The caller's own loop then appended the same fields again, so every field of the model name was duplicated: '/model gpt-5.6' resolved to 'gpt-5.6 gpt-5.6' and SetActiveModel rejected it as an unknown model. '/model gpt-5.6 --provider openai' was worse -- the space-separated provider value was no longer consumed with its flag, giving 'gpt-5.6 gpt-5.6 openai'. Direct model switching over Telegram was broken for anything but a bare --refresh or a provider-only switch. Found while auditing 6d4e0be for archie-core-ifi: the naked return in the same function could not be regression-tested until the function produced correct values.
Design
Two ways to fix the double append were available. Rejected: keep the helper
signature and delete the caller's default-branch append. That restores correct
output but leaves the shape intact -- a helper holding a pointer to the
caller's accumulator, with two loops over the same fields -- so the next person
who adds a field type has the same trap waiting. It also does not fix the
space-separated provider value, because the helper returns early on the first
--provider and never sees the fields after it.
Chosen: splitProviderFlag returns (provider, remaining) and is the sole
accumulator. One loop owns the fields, and there is no shared slice to append
to twice. The index loop is kept deliberately -- i++ after reading a
space-separated value is what removes it with its flag, and converting that to
a range loop is precisely what 651de0a did wrong.
Last --provider wins if repeated, matching the pre-651de0a behaviour rather
than the buggy helper's first-wins. Not worth a flag: /model does not document
repeating it.
Acceptance Criteria
parseModelRest returns the model name exactly once for bare names, scope flags, and both --provider spellings, with a regression test asserting field count rather than string equality.
Imported from beads archie-core-1786637489834-2-109e7cab · GitHub #23 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08
The nestif extraction in 651de0a pulled --provider parsing out of parseModelRest into extractProviderFlag, which took the modelParts slice by pointer and appended every non-provider field to it. The caller's own loop then appended the same fields again, so every field of the model name was duplicated: '/model gpt-5.6' resolved to 'gpt-5.6 gpt-5.6' and SetActiveModel rejected it as an unknown model. '/model gpt-5.6 --provider openai' was worse -- the space-separated provider value was no longer consumed with its flag, giving 'gpt-5.6 gpt-5.6 openai'. Direct model switching over Telegram was broken for anything but a bare --refresh or a provider-only switch. Found while auditing 6d4e0be for archie-core-ifi: the naked return in the same function could not be regression-tested until the function produced correct values.
### Design
Two ways to fix the double append were available. Rejected: keep the helper
signature and delete the caller's default-branch append. That restores correct
output but leaves the shape intact -- a helper holding a pointer to the
caller's accumulator, with two loops over the same fields -- so the next person
who adds a field type has the same trap waiting. It also does not fix the
space-separated provider value, because the helper returns early on the first
--provider and never sees the fields after it.
Chosen: splitProviderFlag returns (provider, remaining) and is the sole
accumulator. One loop owns the fields, and there is no shared slice to append
to twice. The index loop is kept deliberately -- i++ after reading a
space-separated value is what removes it with its flag, and converting that to
a range loop is precisely what 651de0a did wrong.
Last --provider wins if repeated, matching the pre-651de0a behaviour rather
than the buggy helper's first-wins. Not worth a flag: /model does not document
repeating it.
### Acceptance Criteria
parseModelRest returns the model name exactly once for bare names, scope flags, and both --provider spellings, with a regression test asserting field count rather than string equality.
---
_Imported from beads `archie-core-1786637489834-2-109e7cab` · GitHub #23 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08_
sam
added the mediumbug labels 2026-10-27 13:36:42 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The nestif extraction in 651de0a pulled --provider parsing out of parseModelRest into extractProviderFlag, which took the modelParts slice by pointer and appended every non-provider field to it. The caller's own loop then appended the same fields again, so every field of the model name was duplicated: '/model gpt-5.6' resolved to 'gpt-5.6 gpt-5.6' and SetActiveModel rejected it as an unknown model. '/model gpt-5.6 --provider openai' was worse -- the space-separated provider value was no longer consumed with its flag, giving 'gpt-5.6 gpt-5.6 openai'. Direct model switching over Telegram was broken for anything but a bare --refresh or a provider-only switch. Found while auditing 6d4e0be for archie-core-ifi: the naked return in the same function could not be regression-tested until the function produced correct values.
Design
Two ways to fix the double append were available. Rejected: keep the helper
signature and delete the caller's default-branch append. That restores correct
output but leaves the shape intact -- a helper holding a pointer to the
caller's accumulator, with two loops over the same fields -- so the next person
who adds a field type has the same trap waiting. It also does not fix the
space-separated provider value, because the helper returns early on the first
--provider and never sees the fields after it.
Chosen: splitProviderFlag returns (provider, remaining) and is the sole
accumulator. One loop owns the fields, and there is no shared slice to append
to twice. The index loop is kept deliberately -- i++ after reading a
space-separated value is what removes it with its flag, and converting that to
a range loop is precisely what 651de0a did wrong.
Last --provider wins if repeated, matching the pre-651de0a behaviour rather
than the buggy helper's first-wins. Not worth a flag: /model does not document
repeating it.
Acceptance Criteria
parseModelRest returns the model name exactly once for bare names, scope flags, and both --provider spellings, with a regression test asserting field count rather than string equality.
Imported from beads
archie-core-1786637489834-2-109e7cab· GitHub #23 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08