Skip to content
pi-c Check-in [6b85612d46]
Login

Check-in [6b85612d46]

Overview
Comment:Rules give a model family its own key; picker key column (#73)
Timelines: family | ancestors | descendants | both | auth-4
Files: files | file ages | folders
SHA3-256: 6b85612d46257df0bc0a4d97d6c3dd3657908bfaa434f8141820646c6e5e3229
User & Date: dmestas on 2026-11-24 18:06:19.983
Other Links: branch diff | manifest | tags
/auth step 4 (#73): rules give a model family its own key

A rule is the setting keyFor:PATTERN, whose value is a key label. PATTERN is a model id (provider/id) with * for any part. The models it matches use that key of their own provider. The rest of the provider keeps its key. A rule never sends a model to another provider.

Which key a request uses, in order:

  1. the per-process label: --key, the conversation's own key (step 1), or RPC set_credential
  2. the rule for the request's model: an exact pattern first, then the longest pattern that matches
  3. activeKey:PROVIDER, and the rest of the existing lookup order

Where

  • cred.c (core): pic_cred_model(model) tells cred which model the next requests are for. pic_cred_rules, pic_cred_rule_for and pic_cred_rule_set read, match and save rules; cred_rule_of is one new step in cred_choose. pic_cred_used gains rule. A rule as long as an existing one that could match the same models is refused, naming the existing one.
  • provider_http.c sets the model just before a request fetches its key, and main.c model_provider sets it too.
  • Shell: pic auth use P L --for PATTERN [--json] and pic auth use P --for PATTERN --clear. pic auth status lists the rules.
  • JSON: bindings in get_credentials and pic auth status --json. Each pic models --json row gains credential, bound_by and rule.
  • RPC: set_model_credential {pattern, label|null}, saved.
  • TUI: the model picker's key column (tui_mrow.key) reads "second" or "work by rule". In /auth, b on a key takes a pattern, and Enter saves it, or removes it when the key already has that rule. Each row says which families its rules give it.

For the MCP work: cred.c gained new functions and one branch in cred_choose; no existing function changed shape.

Not here

The proposal's scope session for set_model_credential (a rule for one process) is not implemented: rules are always saved.

Tests

  • test/pic/authcmd.sh: a rules section covering the shell, RPC, which key is actually sent, that --key still wins, the conflict refusal, and the pic models --json fields.
  • test/tui/auth.sh: b and the picker's key column.

Tier: core (cred.c, provider_http.c), root (main.c), client (tui); no new file. Clock: pi. Record: settings keyFor:PATTERN. Default: no rules.

Context
2026-11-24
18:14
Catalog test takes the models rows' key fields check-in: 72e1d37d92 user: dmestas tags: auth-4
18:06
Rules give a model family its own key; picker key column (#73) check-in: 6b85612d46 user: dmestas tags: auth-4
17:44
Create new branch named "auth-4" check-in: 173ad922e2 user: dmestas tags: auth-4
Changes