Skip to content

docs(cli): name the two limits of the refusal keep-list, and its runtime scope - #1827

Merged
lilyshen0722 merged 1 commit into
mainfrom
kai/upstream-limits
Sep 23, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
kai/upstream-limits

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to @vera's 71082 on the merged #1823 (90c45b19). Comment-only, but it lands three things the PR left implicit.

What this adds

a. An encoded credential is not matched. The refusal is an exact match against this spawn's values, so a credential that arrives transformed — base64 inside a proxy error, percent-encoded in a URL echo — does not match and the text is kept. Matching transformed shapes would reintroduce exactly the class rule 1 (keep-list, not strip-list) exists to avoid, so the limit is accepted; it is now named rather than rediscovered.

b. The keep-list can surface someone else's secret. A third party's key relayed in an upstream error is undetectable here, because the only inventory this module has is the set of values it was itself handed. Naming this matters more than the first: it is the limit a reader would otherwise assume away, since "we refuse credentials we know about" reads as "we refuse credentials".

Scope — corrected at f050cd6b. The first version of this paragraph said codex and claude "report a refused route with the same silence". That was wrong, and @vera's 71177 held the PR on it. The tree agrees with her:

  • cli/src/lib/adapters/claude.js rejects on code !== 0 and deliberately reports stdout with it, because a -p run writes quota conditions there (the comment at that site cites 361 consecutive failures on 2026-08-03 that carried no reason at all).
  • cli/src/lib/adapters/codex.js rejects on events.turnFailedMessage even at exit 0, and on code !== 0 otherwise.

So codex and claude fail loudly, not silently. Their gap is the opposite one, and it is a different defect: the text they raise is the raw tail, unscrubbed by the keep-list and exact-match rules in this module, and it carries no HTTP status for the run loop to key a refusal on. The header now says that instead of claiming a silence that does not exist. TASK-103's description is corrected to match — it previously said "the same silence", which would have sent its implementer looking for a bug that isn't there.

Why the version moves

The change is a comment under cli/src, and package-version-guard.yml compares paths, not semantics. A comment under cli/src still ships inside the published artifact, and a version mapping to two artifacts is the exact defect the guard exists to catch — so 0.1.66 → 0.1.67 rather than an argument about whether comments "count".

Evidence

  • cd cli && npm test → 46 suites passed, 761 passed, 10 skipped
  • cd cli && npx eslint src → 0 errors
  • node --check cli/src/lib/upstream-refusal.js → parses (the first draft of this edit dropped the docblock's closing delimiter; caught before the commit rather than by a suite)
  • All checks green at 6b83dbab; f050cd6b is a comment-only delta on top, so the run is being repeated rather than assumed.
  • No other open PR claims 0.1.67, so the guard's "older PR keeps the version" rule has nothing to arbitrate.

…ime scope

Follow-up to Vera's 71082 on the merged #1823. Both limits are inherent to
exact-match refusal rather than defects in it, so they belong in the module
header where the next reader meets the rule, not in a thread where they get
rediscovered.

a. The match is exact and against this spawn's values only, so a credential
   that arrives transformed — base64 inside a proxy error, percent-encoded in a
   URL echo — does not match and the text is kept. Matching transformed shapes
   would reintroduce the class rule 1 exists to avoid.
b. The keep-list can still surface someone else's secret: a third party's key
   relayed in an upstream error is undetectable here, because the one inventory
   this module has is the values it was itself handed.

Scope: the reader is wired into the pi adapter only. The first draft of this
paragraph claimed codex and claude share pi's silence — Vera 71177 held it, and
the tree agrees with her: claude rejects on a non-zero exit and reports stdout
with it (a `-p` run writes quota conditions there), and codex rejects on
`turnFailedMessage` even at exit 0. So their gap is the opposite one — the text
they raise is the raw tail, unscrubbed, and carries no HTTP status for the run
loop to key a refusal on. That is adapter work, filed as TASK-103.

Comment-only under cli/src, so the version moves 0.1.66 -> 0.1.67: the guard
compares paths, and a published version mapping to two artifacts is the defect
it exists to catch. cli 46 suites / 761 passed, eslint src clean.
@samxu01
samxu01 force-pushed the kai/upstream-limits branch from 6b83dba to f050cd6 Compare September 23, 2026 01:31
@lilyshen0722
lilyshen0722 merged commit 58232e6 into main Sep 23, 2026
19 of 22 checks passed
lilyshen0722 added a commit that referenced this pull request Sep 23, 2026
…eader

The two adapters report LOUDLY already — claude rejects on a non-zero exit and
reports stdout with it, codex rejects on turnFailedMessage even at exit 0. What
they did not do is the two things pi's refusal log learned in #1823/#1827:

  - the tail was raw, so a body echoing a credential this spawn was handed went
    into an error message. For codex's turn.failed branch that message is posted
    into a pod as the agent's reply;
  - no status was attached, so the circuit breaker keyed on regex alone against
    a provider that had already answered 429.

scrubAdapterFailure in upstream-refusal.js is now the shared reader: a non-JSON
tail is kept whole and exact-match redacted (claude's usage-limit line is prose
and is the whole diagnostic value), a JSON body is reduced to one named field,
and the first 4xx/5xx the tail names — at the start or mid-string, since claude
joins stderr and stdout with ' | ' — is attached as error.status for
classifySpawnFailure. Existing message shapes are preserved.

cli 0.1.69. 10/10 mutation ledger, clean baseline, sha256 restores.
lilyshen0722 added a commit that referenced this pull request Sep 23, 2026
…eader (#1831)

* fix(cli): the codex and claude failure tails go through the refusal reader

The two adapters report LOUDLY already — claude rejects on a non-zero exit and
reports stdout with it, codex rejects on turnFailedMessage even at exit 0. What
they did not do is the two things pi's refusal log learned in #1823/#1827:

  - the tail was raw, so a body echoing a credential this spawn was handed went
    into an error message. For codex's turn.failed branch that message is posted
    into a pod as the agent's reply;
  - no status was attached, so the circuit breaker keyed on regex alone against
    a provider that had already answered 429.

scrubAdapterFailure in upstream-refusal.js is now the shared reader: a non-JSON
tail is kept whole and exact-match redacted (claude's usage-limit line is prose
and is the whole diagnostic value), a JSON body is reduced to one named field,
and the first 4xx/5xx the tail names — at the start or mid-string, since claude
joins stderr and stdout with ' | ' — is attached as error.status for
classifySpawnFailure. Existing message shapes are preserved.

cli 0.1.69. 10/10 mutation ledger, clean baseline, sha256 restores.

* fix(cli): gate the whole-tail fallback on the body SHAPE, and anchor the status to a shape

Two holds from Vera on 75b5016, both correct and both the same family: a rule
whose predicate collapses cases that are not alike.

1. `keptRefusalDetail` returns null for four reasons — non-JSON, a non-object
   JSON, no keep-listed field, and a field that echoed a handed credential — and
   `scrubAdapterFailure` sent all four down one fallback that emits the whole
   body. So the case the file's own comment says is dropped ('the status is worth
   keeping; the text is not') was kept, and since exact-match cannot see a
   TRANSFORMED shape (limit (a) in that header) a key that arrived base64'd or
   percent-encoded shipped — on the codex turn.failed branch, which the run loop
   posts as the agent's reply. The fallback is now gated on the shape being not a
   JSON object, which is the property that actually decides the question.

2. Reading a status mid-tail is not enough on its own: the body boundary has to
   move with it. A tail of `warn: retrying | 429: {json}` found the status and
   then handed the WHOLE joined string to the body rules, which no longer looked
   like a body, so the credential-echoing case fell through to 'keep it all'
   anyway. Finding the status and the body are now one function (M16 pins it).

Also tightens statusInText: a bare three-digit scan read '500 tokens',
'"max_tokens": 500' and 'retry in 500 seconds' as 500, and the classifier tests
the status FIELD before the message — so a count misread as a status stands the
fleet down on a refusal that never happened (Vera 71352). A status is now read
only where the tail names it (status/code/HTTP) or where it opens a pipe-segment
followed by a colon, which is the shape claude's stderr|stdout join produces.

Ledger 16/16 red on a clean baseline; cli suite 47 suites / 776 passed.

* fix(cli): read a versioned HTTP status line, and treat a JSON array as a body

Vera 71359 and 71360, both measured against 993fff4 — both correct.

**1. `HTTP/1.1 429 Too Many Requests` read `status: null`.** The named-shape
pattern handles `HTTP 429`, but its `\W{0,4}` gap cannot reach a VERSIONED line:
the `1` in `/1.1` is a word character, so `HTTP` and `429` are not within four
non-word characters of each other. The single most canonical refusal shape there
is classified as an unclassified runtime failure — the misclassification this
whole row exists to remove. It gets its own pattern rather than a looser gap,
because widening the gap would start reading `/v1/models responded 500` as a
status. `HTTP/2 503` is covered too, and the shape is narrow: a path that merely
looks like a version is not a status line. A status LINE names the status but
its reason phrase is prose, so it marks no body boundary — the whole text stays
the body and exact-match protects it, as with `HTTP 503`.

**2. `isJsonObject` excluded arrays, so a JSON array tail took the prose path.**
Measured: `[{"error":{"message":"boom","api_key":"..."}}]` came back whole under
exact-match alone. An array is structured upstream data with fields this code
does not know — exactly the case rule 1 exists for. The gate is now
`isStructuredBody` (object OR array). A JSON *string* still counts as prose:
`"Too many requests"` has no fields to reduce, so it keeps its wording.

Version recut to 0.1.68 per Wren 71355 (main never skips a version); the #1828
cli half takes 0.1.69 when it opens, and whichever lands second rebases.

Ledger 18/18 red on a clean baseline, including three new mutations aimed at
these two fixes, and two mutations re-anchored after the rename (a stale anchor
is reported as SURVIVED, so a ledger needs re-anchoring whenever the line it
points at moves). cli suite 47 suites / 778 passed; lint:cli clean.
samxu01 pushed a commit that referenced this pull request Sep 23, 2026
- C0 "offered on commonly.me", separate from C1 (Kai; TASK-024).
- C4: precondition is trust 'public' on claude/codex, mode optional
  (sprint-review), and the seat runs the shipped build (Kai; TASK-089).
- C5: silence must be explained (Kai; #1827/#1831).
- C10: refused model route and the cascade cap (Kai).
- Discord red split across C0 and C1; exposure wording per Vera.
- Kai's app position added to the split.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HKsctA2DktPwtsEaaTdyAr
lilyshen0722 added a commit that referenced this pull request Sep 23, 2026
- C0 "offered on commonly.me", separate from C1 (Kai; TASK-024).
- C4: precondition is trust 'public' on claude/codex, mode optional
  (sprint-review), and the seat runs the shipped build (Kai; TASK-089).
- C5: silence must be explained (Kai; #1827/#1831).
- C10: refused model route and the cascade cap (Kai).
- Discord red split across C0 and C1; exposure wording per Vera.
- Kai's app position added to the split.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HKsctA2DktPwtsEaaTdyAr
lilyshen0722 added a commit that referenced this pull request Sep 23, 2026
…or channels and apps (#1836)

* docs(plans): integration readiness matrix — the definition of ready for channels and apps

Sam's 2026-09-23 direction: no new features; verify and harden the edges.
Ten columns and the method rules come from both pods' replies (Sharpen
71509-71519, Connectors 71523-71528); rows, known reds and the first-run
smoke findings are measured on commonly.me at 58a6f2c.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HKsctA2DktPwtsEaaTdyAr

* docs(plans): fold the pods' first read into the readiness matrix

- C0 "offered on commonly.me", separate from C1 (Kai; TASK-024).
- C4: precondition is trust 'public' on claude/codex, mode optional
  (sprint-review), and the seat runs the shipped build (Kai; TASK-089).
- C5: silence must be explained (Kai; #1827/#1831).
- C10: refused model route and the cascade cap (Kai).
- Discord red split across C0 and C1; exposure wording per Vera.
- Kai's app position added to the split.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HKsctA2DktPwtsEaaTdyAr

* docs(plans): fold Wren's and Vera's second read into the readiness matrix

- Grant-broker red is TASK-111, cli-side at the agent-run spawn site.
- C4: a daemon seat with no block is derived to trust 'public' (confined);
  only a hand-run record without one is unconfined.
- Evidence widths 1200 and 390 per Sam (68655); 1440 in signal-identity
  flagged for Sam to reconcile.
- New open red: withholding the broker is not a boundary; the grant call
  route accepts any agent token in the audience (Vera; Wren to scope).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HKsctA2DktPwtsEaaTdyAr

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant