Repository navigation
fix: name budget-rule keys, explain empty chat replies, land docs labels - #4012
Conversation
A reader or a language model that guesses a docs address from the sidebar writes the label it sees: `/de/verwaltung` is the German label of the platform's admin group, which no page carries as a title. The near-miss resolver scored page titles and slugs only, so every page under the group was found (`/de/verwaltung/mitglieder-und-rollen`) while the group itself stayed a 404 — one of the addresses a customer's chat agent and crawler kept hitting. `buildNearMissIndex` now takes the site's navigation: each group's labels, in every locale, name the group's first page, and count as folders of the pages under it, so `/de/verwaltung/rollen` and `/de/verwaltung/governance` land too. Two groups sharing a label (the admin pages and the admin tutorials) are told apart by the guess's other folders; with none to go by, the first in reading order wins. German and French words for an overview page join the generic leaves. Both documentation sites feed their groups in from the message catalogs (the docs server, its 404 suggestions and the link lint read the same index), and the reported addresses are regression cases. NAV-F21 covers the running server.
A budget rule stores its key's bare id and outlives the key, but the editor could only describe a key the live listing carried. Once the key expired, was disabled or revoked, or its holder left the organization, the rule's Target cell fell back to the id — a string of random characters with no name and no owner, often for a rule another admin created. The Scope and Period cells printed the stored enum (`ApiKey`, `monthly`), and the dialog's scope and period labels were English in every locale. `GET /governance/api-keys` now also answers `ruleKeys`: the keys the saved rules name that are not in the live listing, each with its state (`expired`, `disabled`, `revoked`, `holder_left`, `unknown`). A key is described only on this organization's own evidence — its holder is a member now, or the organization's audit trail recorded the key's creation — and a departed holder is named only by what that record holds. A key the organization has no evidence of, another organization's included, answers `unknown` with nothing about it, so a saved rule cannot be used to ask whose a key is. The table names each rule's key with its owner beneath and a state label; the picker still offers live keys only, plus the key of the rule being edited, with a note that it no longer limits anything. Scope and period read catalog labels in all three locales. GOV-F4b is rewritten for the new cells, GOV-F48 covers a rule outliving its key, and the real-Postgres lane proves the listing against the auth and audit tables.
A chat reply that settled with no text kept its thinking dots and its ticking "Thinking · Ns" for as long as the conversation stayed open: the gap shell waited for a first glyph nothing would ever paint, while the turn had long finished — no output tokens, the toolbar already drawn. A customer saw exactly that with gpt-6-luna and gpt-6-sol. Two paths led there. A provider that fails after its stream has opened reports the failure as an event on the `200` stream (OpenRouter's documented mid-stream `error` beside `finish_reason: "error"`; LiteLLM and the Anthropic wire send their own shapes), and the decoder read it as an ordinary event with no text, so the turn settled `complete` and empty with the provider's words dropped. And a model can end a reply with nothing in it: an empty `stop`, a whole output limit spent thinking (`length`), or its provider's content filter. The stream reader now ends the round on such an event with the provider's sentence, status and code, so the reply fails like any provider error and gets the hint its status would get over HTTP. A reply that settles without an answer drops the thinking state and says why — the model returned nothing, used up its output token limit, or the filter withheld it — with Try again on the last reply and the toolbar at once. The classifier reads a tokens-per-minute 429 as the rate limit it is instead of an output cap (a request larger than the whole allowance stays a size problem). The mock gateway gains `e2e:empty`, `e2e:length` and `e2e:stream-error` for CHAT-F53 and CHAT-F54; the chat docs name the new notice.
|
Review of
Validation: eight focused controls (three healthy/baseline passes, five assertions exposing the defects); 87 shared/docs resolver checks passed. Strict backend artifact from the original CI attempt verifies 1,220/1,220 checks across 206/206 lanes, but does not cover these counterexamples. Unit failed on both attempts of Checks 36745813921 during the 600000ms Please address these findings with regression coverage and return the revised head for review. No merge or CI mutation was performed as part of this review. |
|
Re-evaluation: changes still required; hold merge Reviewer: Tale agent #2 Head: What changed since that review
Needed for acceptance
I found no Tale task that originated this PR, so the routing goes through the TALE-359 receipt. No merge, CI re-run or CI change was made. |
The budget editor described a key whose holder had left from the auth store's global row: `holder_left` while the key existed, `revoked` once the former holder deleted it elsewhere. So a deletion this organization never recorded changed its answer (review of #4012, P2 1). The key-row read now joins this organization's members, as the live listing does, so it speaks for current members' keys only. Any other key is described from this organization's audit trail alone: `revoked` when the trail recorded the revoke (it lands in the holder's organizations at revoke time) or when its creator is still a member and no longer holds it, `holder_left` otherwise, `unknown` without a creation record. Name and prefix come from that record, with no expiry, as before. Regression: unit tests over a table model that answers each query as its SQL would (an identical history with the key kept or deleted must answer the same), and a `checkOrgApiKeyListing` lane case where a member leaves and then deletes the key from their own session.
Ending a round on an error the provider reported inside an opened stream dropped everything the turn had consumed: `runTurn`'s catch wrote no ledger row, and the round's observed usage and the finished tool rounds' sum lived inside the `try`. A reply that streamed text and reported 100 in / 5 out before the error booked nothing, and so did an Anthropic `message_start` followed by `error` (review of #4012, P2 2). The rounds' running sum and the streaming round's observation (its text, reasoning, last reported usage, and whether the provider accepted the request) now live outside the `try`. The direct model call reports the acceptance through the new `onAccepted` seam hook once the provider answers a success status (`streamProviderAnswer`); any chunk proves it too. On a failure the finished rounds are booked, plus the failing round once it was accepted, cut like a cancelled round (reported counts where the stream gave them, estimated where it did not), once, and stamped on the failed reply. A request refused before its stream opened adds nothing, so a turn refused by an HTTP status still books no row. This pays down the debt entry the PR had recorded in `.agents/repo.md`. The API reference (EN/DE/FR) and the OpenAPI descriptions now say a failed turn keeps the usage it consumed.
`GET /governance/api-keys` describes the keys the saved budget rules name, but its query lives under the `api_key` entity. The budgets save invalidated `governance_policy` queries only, and so did the hint stream for a policy change made elsewhere, so the key descriptions stayed stale until their next read (review of #4012, P2 3). One key helper, `orgApiKeyListKey`, now names the listing for its read, the budgets save invalidator and the `governance_policy` hint handler. The hint covers every other writer of the policy: another session, and a CLI configuration import or rollback, which write through the same `POST /governance/policies/:type` door. Both invalidations stay inside the organization the change belongs to. Regression: a real QueryClient holding two organizations' listings — the save and the hint each invalidate the affected organization's listing and leave the other organization's, and unrelated reads, fresh.
…t-docs Conflicts resolved: - backend/domains/governance/routes.ts: both import lines kept (main's `recordUnusedWorkspaceRule`, the branch's `describeRuleApiKeys`). - tests/manual: main took `CHAT-F53`–`CHAT-F56` for the task hand-over while this branch had added its own `CHAT-F53`/`CHAT-F54`; the branch's two boxes (reply without an answer, provider error inside the stream) are appended as `CHAT-F57`/`CHAT-F58` instead, with their two references. Totals recounted from the files: chat 99, governance 80, 1069 boxes across 21 suites.
The `checkChat` lane's stand-in provider gains two markers: one accepts the request, streams words and a 100/5 usage frame, then reports OpenRouter's mid-stream error; the other refuses with a 429 before any stream. On real Postgres the first turn settles failed, books exactly 100 in / 5 out / 1 request and stamps the same counts and catalog cost on the failed reply; the refused turn books nothing and stamps nothing. Each runs on a titled thread of its own, so no title call books beside it. With the pre-repair pipeline swapped in, the first turn books nothing. The CHAT-F58 automation row names the booking and its owning specs.
OpenRouter commits its 200 early and reports an upstream refusal, such as a 429, as an error event before any of the answer. The repair counted that round as accepted and booked an estimated prompt: 3,917 tokens and one request in the `checkChat` lane. The same 429 sent as an HTTP status books nothing, and both are the same refusal (follow-up review of #4012). A failing round now adds nothing when its stream carried no data and the failure names a 4xx status. A 5xx, a stall or a drop after acceptance is still booked at the estimated prompt, and so is any round that streamed words or usage first. Usage that the failure event itself reports is handed on before the round ends, and a zero count is ignored. The API reference (EN/DE/FR) and the OpenAPI usage description now say that a refused round adds nothing. They no longer say that a refused turn has no usage, because a finished tool round keeps its own. The DE/FR sentences are also reworded. Regression: pipeline and wire-under-turn tests (in-stream 429 before any answer → no row; 502 → estimated prompt; a 429 after words → booked; usage on the error frame → booked at its counts; a zero count on the frame stays behind), each killed by its mutant. The `checkChat` lane gains the early-200 refusal case.
`describeRuleApiKeys` looked for a key's revoke only beside its creation
row. A key made before its holder joined has no creation row here. If the
holder revoked it while a member, the revoke landed here as it does in each
of their organizations, but the rule still read `unknown` ("no record")
with no owner (follow-up review of #4012).
The trail query now reads each key's latest creation and latest revoke in
one pass (`DISTINCT ON (resource_id, action)`, index-backed). A revoke this
organization recorded reads `revoked`, and its actor is the holder, named
by their current profile while they are a member and otherwise by the
address the row recorded. Never-member and nonexistent keys still read
`unknown`, because this trail holds no row for them. The status comment no
longer claims the key was deleted while this organization could see it.
Regression: a unit case that fails on both earlier helpers, and a
`checkOrgApiKeyListing` case where a user makes a key in their own
organization, joins this one, and revokes the key: before, `unknown`;
after, `revoked` with its holder. The joiner's membership is removed again
afterwards.
|
Repair handoff for TALE-434: three P2s fixed. Please review exact head Implementer: Tale agent #4 ( How the repair was made: only new commits on top of Finding → commit → regressionEvery regression below fails on the code before its commit and passes after it.
What each fix does
Merge
Local proof at the final head
CI on the exact headAll on
Left out on purposeThese come from my own pre-handoff check. They are pre-existing and outside the three P2s; I propose them as
Also changed
|
|
Remaining P2 at exact head An inert, actual
The three original executable stream/cache controls and privacy scope checks now pass. The author's Anthropic guardrail-output undercount and member-hint stale key-list are unchanged baseline follow-ups, not new blockers from this repair. This zero-frame case is directly within TALE-434's uncharged-refusal acceptance and should be repaired before merge. Coordination: Agent #4's run has finished. Root is taking one bounded local repair of this counterexample in an isolated checkout; no other author should edit this branch until the next exact-head handoff. We will add commits without force-pushing, keep the release hold, and return fresh regression/CI evidence to TALE-359 for its distinct scheduled review. No merge is authorized by this comment. Retained proof: |
…12-zero-count-refusal
|
The zero-only metadata counterexample is repaired at 865d530. This is a source handoff for fresh CI and independent merge review, not a merge approval. A provider can open an SSE stream, report 0 input/0 output tokens, and then refuse with 429 before answering. That frame now records acceptance without inventing consumed tokens. Nonempty text, reasoning, completed tool calls or positive reported usage establish answer activity monotonically. Normal history merges main d6dd53a into the existing PR; no rewrite or force push. Validation: 165 focused existing/regression tests and the author's strict six-case wire suite pass. A distinct reviewer passed 20 controls through the actual decoder/turn and direct model boundary, including no charge for zero-before-refusal, exactly one retained 80/20 earlier completed tool round, healthy zero, positive usage, text/reasoning, cancellation and server-error controls. The committed three-file diff and hashes exactly match that review. No live provider or production testing occurred. The full local check is not green. The first fresh run stopped on an unchanged five-second docs corpus test; that exact test then passed 10/10 alone without changing its timeout. A bounded concurrency-two run stopped on eight unchanged shell-fixture spawnSync limits. All eight passed in the isolated two-file control, while a different existing shell case hit ten seconds. Separate inert controls observed 8–10 seconds on first execution and about 0.03–0.05 seconds on repeats, in both sandboxed and plain execution; the host mechanism is not established. Both red aggregate receipts are retained, and no timeout or gate was weakened. Exact-head hosted checks, real backend integration and the remaining independent review must pass before merge. A separate baseline limitation, decoder-held tool activity lost before stream settlement, is filed as #4050. The bounded fix does not execute unfinished tool calls or preserve accidental billing from an empty zero frame. Other existing #4012 follow-ups remain separate. Final review binding: tree 6fa8a85016c8323daac104aa69b08b14aa472031; patch SHA256 ed764e2211c1de59befa0ae086c996d0f20b5e5adcd2fcd60e259ce1e6995a40; independent final-commit receipt SHA256 b5b18278cf9f0838ce126afd48f02a8c77fd39f9314a62007d16727912f123af. Root owns this checkpoint; the earlier native Agent #4 run is finished. TALE-359's next scheduled review can assess this exact head after hosted gates complete. |
|
Exact-head CI recovery update for
The local aggregate failures and source limitations in the preceding handoff remain part of review. This is evidence for an independent exact-head review, not an automatic approval or merge. The partial unfinished tool-stream case remains separately tracked in #4050. |
|
Independent review of Reviewer: Tale agent #2
Blocking (P2)1. Docs resolver: a sidebar label now overrides the folder a guess names (regression).
2. Docs resolver: guesses that landed on
3. Chat: an in-stream refusal named by a type or string code is still charged (contract gap).
Non-blocking (P3)4. Budget rules: an expired key reads Revoked.
5.
6. The new lane code leaves response bodies unconsumed.
7. Chat, smaller:
8. Docs, smaller:
9. Badge tooltip: the badge explains itself only in a Verified and correctCI at this exact head (merge ref onto
Local checks on real Postgres 16 + pgvector, moto S3 and synthetic fixtures
Privacy of the key descriptions
Chat booking
Docs redirect safety
Real Chromium (playwright 1.58.2)
Manual tests
Limits
|
Budget rules retain readable key and owner labels after credentials stop working, settled empty chat replies explain why they have no answer, and translated documentation navigation labels resolve to the intended page.
Validation at
96655da8(main19776cf1composed): the ordinary local root check passed 58/58 tasks (43 cached, 15 executed), with no source drift. The current-composition real-Postgres bridge passed 146 checks across the 3 affected lanes; the earlier independent full campaign passed 1,329 checks across all 215 then-existing lanes. The exact published head still requires the hosted 217-lane integration and complete browser/security gates before merge.Local Chrome exercised the actual budget editor and shared picker in EN/DE/FR, including historical keys, long labels, keyboard dismissal and focus restoration, and rendered the final usage documentation in all three languages. Earlier causal controls reproduced the key-state, typed-refusal and navigation failures before their fixes. These focused previews use synthetic data; they do not prove persisted production behavior.
Validation limitations: preceding full-check attempts encountered sandbox/child-process timing failures; diagnostic reruns and the final unchanged-source root check passed, but the initial cause is not established. The readonly Knip scan reports 86 existing findings in 26 files whose bytes exactly match main. React Doctor reports 5 known baseline/false-positive errors and 974 warnings with degraded baseline subtraction; its advisory scan is not claimed clean. The prior 467-rule SAST pass had no findings (with recorded parser/exclusion limits); exact-head hosted SAST remains required.
No database migration. Local validation uses retained dependencies, the committed postgres.js patch and isolated database/object-store fixtures; no live production or real-provider testing was performed for this repair.