agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

fix(cli): reject unknown keys in project set-config JSON

Open somewherelostt opened this issue 2 months ago • 2 comments

Problem

ao project set-config <project-id> --config-json '{"typoOnly":true}' succeeds because the CLI decodes JSON into its own struct with json.Unmarshal, which ignores unknown keys. The command then sends the resulting empty object as a full configuration replacement. This can clear a project's existing configuration without warning.

The daemon's direct config API rejects unknown fields, so the CLI and API have different validation behavior. The public docs now describe the current limitation in PR #6166.

Expected behavior

Reject unknown keys before sending any replacement, with a useful error that identifies the key. Keep the current full-replacement semantics for valid fields. Add a CLI test covering a typo-only object and confirming the stored config is unchanged.

This is the current Go CLI's --config-json path, separate from the legacy YAML loader issue #2653.

somewherelostt avatar Oct 02 '26 23:10 somewherelostt

I'd like to work on this. #6834 was closed, and #7318/#7531 have since added effort and preRemove to the CLI mirror, so strict decoding no longer rejects any valid key. I'll write it fresh on current main.

pablogore avatar Nov 03 '26 14:11 pablogore

10. I'd like to work on this. #6834 was closed, and #7318/#7531 have since added effort and preRemove to the CLI mirror, so strict decoding no longer rejects any valid key. I'll write it fresh on current main.

@pablogore please go ahead

Rishet11 avatar Nov 03 '26 15:11 Rishet11