Skip to content

fix(platform): close the 2026-09-26 platform evaluation's S2 findings - #3491

Merged
larryro merged 19 commits into
mainfrom
fix/eval-0926-s2
Sep 26, 2026
Merged

larryro merged 19 commits into
mainfrom
fix/eval-0926-s2

Conversation

@larryro

@larryro larryro commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the confirmed S2 findings of the 2026-09-26 platform evaluation (build 0.5.55). Every finding was re-verified against main before the fix; one sub-point was refuted (A-03's "stopped reply shows more text in the share" is cancel latency, not a share defect) and one part is by design (mask mode stores the masked message — now documented).

Chat

  • A-02 Retry then Edit lost a branch: a fork was taken from the thread on screen, so a chain R→B1→B2 formed at one sequence and the switcher showed 2/2. Forks are now flattened onto the fork point server-side, the read side merges legacy chains, a flip writes the whole selection chain.
  • A-03 A share published the root's branch, not the one on screen, and "Include newer messages" re-stamped the root. The share freezes the viewed leaf (thread_metadata.shared_thread_id, migration 0114) and republish re-takes it.
  • B-01 A rag_search hit was cut to 500 chars although the whole 2 KB chunk was in memory — facts past the cut read as "not found". A hit now carries the whole chunk under a per-response budget; the tool descriptions tell the model to fetch a cut snippet before concluding a fact is absent.
  • B-06 Product/contact rows carried four fields; the model stated "currency not specified" as fact. Every user-facing field rides the row.

Guardrails

  • A-04 / E-21 \b\d{8}\b (Swedish passport) and a weak NZ IRD checksum turned order numbers, dates and build numbers into [PASSPORT]/[NZ_IRD] for every org (all 43 locale datasets run by default). Digits-only national-ID specs are gated by context keywords or a check digit; nine already-implemented checksums are wired; a data guard refuses a new bare spec. Docs say the stored message is the masked text.

Projects / agents

  • C-08 Two root causes, neither the DeepSeek wire format the evaluation guessed:
    1. Every managed Codex run exited 1 in ~4 s: CODEX_HOME pointed at a directory the runtime entrypoint never created. Created now; the image test pins the registry's state roots to the entrypoint and starts Codex to see it announce its thread. A crashed harness's last stderr lines are quoted in the run's reason. Needs a sandbox-runtime image rebuild + ops pin bump to reach production.
    2. Before the harness could even start, the session key's mint was refused: on the OpenAI-wire lane the serving model and the org's vision model (the same DeepSeek model) landed on one gateway record and the whitelist carried the model twice — the gateway answers 400 "duplicate value … in whitelist". Reproduced live on the dev stack after (1) was fixed; each spelling is whitelisted once now, and the gateway's refusal text rides the run's error instead of a bare status. This is the likeliest reading of the evaluation's "mint key failed (400)" on other models too.
    3. With both fixed, every Codex + DeepSeek run failed on its second model call: Codex speaks the Responses API, the gateway translates it to chat completions for the chat-only custom DeepSeek record, and that translation cannot hand Codex a reasoning item it echoes back — DeepSeek refuses the tool-loop replay (400 "reasoning_content … must be passed back"). Reproduced with the pinned CLI through a recording proxy on the gateway's v1.6.11 and on v2.2.3 (a bump does not fix it). Codex now rides the connector's native Anthropic harness endpoint (the …__anthropic record Claude Code uses) when the gateway would otherwise serve the connector as a custom chat-only upstream; verified live on both gateway versions. Harness definitions declare their managed-lane wire (gatewayWire). The run's reason now carries the provider's own sentence and status (turn.failed was dropped before; the assistant's narration stood in as the reason), and the status lets the kick start a fresh conversation on a 400.
  • C-09 Deleting a skill bricked every agent equipped with it. A delete unequips the slug from every agent (audited as skill.deleted), an update validates only added equipment, the menu lists an unshared skill as a removable "(unavailable)" entry, and a missing-skill start settles as equipment_missing (no auto-retry).

Automations

  • D-15 Two editor tabs silently reverted each other. The editor pins the version its draft started from; the store refuses a stale base with 409 AUTOMATION_VERSION_STALE; the editor offers reload or save-anyway.

Governance

  • E-02 Only the app door's team delete was audited. Every team write is now: team.created/.updated/.deleted/.member_added/.member_removed from the app doors (in their transactions), the Better Auth plugin hooks, and SSO group sync (actorType system, door: sso); the plugin's own add/remove-team-member doors are closed (the UI never used them).
  • E-04 API keys (api_key.created/.revoked/.updated, fanned out per organization like the 2FA lifecycle rows, now through one shared recordUserScopedSecurityEvent), WebDAV app passwords (webdav_app_password.created/.revoked, prefix only) and connector credentials (connector_credential.created/.updated/.deleted, never the secret or config) leave audit rows.
  • E-19 Branding saves, image uploads and deletes (branding.updated/.image_uploaded/.image_deleted), and every WebDAV document write (document.created/.updated/.trashed, one folder.deleted per cascade) are audited through shared helpers the UI paths now use too. Labels in en/de/fr for every new action and resource type.
  • E-15 Legacy user:/api-key:/trigger: ledger rows read as separate users and escaped the personal cap; every reader folds them onto the person.
  • E-16 The ledger upsert stamped 0 audio seconds on every second request and the classifier read that as a transcription — 97 % of chat spend fell out of Top models. Fixed on both sides; no backfill needed.
  • E-10 Typing one character into the accent hex field spun the renderer forever (NaN lightness walk). Bounded walks, and the preview only receives a complete hex.

Inbox / API

  • F-11 deleted: true hard-deleted a mirrored conversation's messages; the docs promised preservation. A teardown now only closes the mirror.

Cross-cutting

  • G-07 A list whose read failed for good rendered the first-run empty state ("No projects yet"). useListPage carries the request error; the table shows its error state with retry; errored reads refetch on focus and when the hint stream reconnects.
  • G-05 / G-01 (S3) The service worker's precache listed nine files twice, so Workbox cached nothing: no offline page under a "ready to work offline" toast, and "Update available" on a first visit. Precache is the revisioned asset set only, a build guard refuses duplicates, the update prompt needs a controlling worker and carries a Later.

Not verified here

  • backend:integration end to end: the audit probes passed in filtered lanes on a throwaway Postgres; the full run stops at a pre-existing checkNativeIdentity failure on the dev machine before the chat share/branch probes (migration 0114) — CI runs it.
  • The Codex fix needs the rebuilt sandbox-runtime image; the image conformance test runs in CI.
  • No real-browser drive of the chat branch/share flows; manual boxes CHAT-F44/F45 describe the checks.

Out of scope (noted for follow-up)

  • Runtime picker capability matrix (Codex is Responses-only; custom OpenAI upstreams are provisioned chat-only) — masked until now by the CODEX_HOME failure.
  • Automation llm nodes book no usage at all (the "Automations (triggers)" row only ever reflects managed-agent nodes).
  • Project-shared readers of a chat still see the root branch only.
  • Persian address fixtures were only ever "detected" through the national-ID lookalike; they are now asserted as the address miss they always were.

… Top models

The usage page bucketed the ledger by the raw `user_id`, so rows the workflow
lane booked before it derived the person from the run's starter (`user:<id>`,
`api-key:<id>`, `trigger:<id>`) read as three "users", inflated the active-user
count and escaped the person's own cap. Every reader now folds a door form onto
the person (`usageLedgerSubject`) or the automation bucket, and the budget gate
sums a member's spend under every form it was ever booked as.

The ledger upsert also stamped `0` on `audio_duration_sec` and `character_count`
the moment a bucket took its second request, and the classifier read any
defined seconds as a transcription — so nearly every chat bucket fell out of
Top models (35 of 1,072 requests shown). The upsert keeps NULL + NULL as NULL
and a row is a transcription or speech row only for a positive quantity.
A `deleted: true` snapshot ran the content reconcile over its (required)
empty message list and hard-deleted every receipted message, so the Closed
tab read "No messages yet" one step after showing the transcript — while the
reference promises that closing preserves the conversation and its messages.
A teardown now only closes the conversation and records the source deletion;
the integration check pins the surviving transcript and the spec says so.
Every keystroke in the accent hex field reached the preview as `#E`, `#E1`,
… — a partial hex parses to NaN channels, and the theme-contrast walk in
`adjustColorForTheme` neither clamps nor clears a threshold on NaN, so the
renderer spun forever on the first character typed. The walks are now
bounded and skip anything that is not a complete hex, the form hands the
preview only the last complete color while a shorter value is typed, and
the picker reuses the one `isHexColor` predicate.
A rag_search hit was cut to its first 500 characters although the retrieved
chunk (2,048 code units) was already in memory, so a fact past the cut — in
a short document's only chunk, or at the end of a PDF page — was answered
as "not found" while the search had retrieved it. A corpus hit now carries
the whole chunk under a per-response budget (the default page of hits;
later hits keep the short head and their fetch offset), a knowledge entry
the same, and the tool descriptions tell the model to fetch a cut snippet
before concluding a fact is absent.

The product and contact rows were a projection of four fields, and those
rows are the model's only view of a record (the kinds cannot be fetched),
so it stated "currency not specified" and "locale not set" as facts about
records that carried both. Both rows now carry every user-facing field.
…from a controlled page

The generated service worker listed nine public files twice — hashed from
`public/` by `includeAssets` and the manifest icons, and again with
`revision: null` from a workbox glob over `dist/assets/` — and
workbox-precaching refuses a URL with two revisions at install, so the
worker activated with an empty cache: no offline page, while the client
still announced "ready to work offline". The precache is now exactly the
revisioned `includeAssets` + icon set (no glob), and
`scripts/check-sw-manifest.ts` refuses a duplicate or un-revisioned entry
after every platform build, in `bun run build` and the image build.

"Update available" also fired on a first visit (a page nothing controls yet
has no version to update from) and sat for a minute over the primary
controls with no way to close it. The listener prompts only when a worker
controlled the page at mount, the toast lasts fifteen seconds and carries
a "Later" close.
… identifier

An organization that never picked locales runs every national-ID dataset,
and a digits-only spec with no check digit — the Swedish passport
`\b\d{8}\b` above all — matched every 8-digit order number, compact date
and build number in a chat, rewrote the stored message to `[PASSPORT]`
and broke the tool lookups built on those values; the NZ IRD checksum
passed one random number in eleven. A national-ID spec may now declare
`contextKeywords`: the value counts only right after a word that names
it (`passnummer`, `ІПН`, `IRD number`), the way phone numbers already
work. Every digits-only spec without a check digit is gated that way,
the check digits the engine already implemented but no spec declared
(Czech, Danish, French NIR, Italian, Japanese, Korean, Portuguese,
Russian INN, Saudi, Singapore) are wired in, and a data guard refuses a
new digits-only spec that has neither.

The ten Persian address fixtures were only ever "detected" through that
lookalike on their postcode; they are now asserted as the address miss
they always were. The guardrails page says that a chat stores the masked
text and that the events list names the pattern that fired.
…ab overtook

Two editor tabs on the same automation silently undid each other: a save
appended `max(version) + 1` with no notion of the version the draft was
built on, so tab B (still holding a v5 draft) saved v7 with tab A's v6
change reverted — and B's version switcher had already moved to v6, so the
draft was even labelled with the wrong base. The editor now pins the base
version on the draft's first edit and sends it; the store, under the
per-name lock, refuses a save whose base is no longer the latest with
409 `AUTOMATION_VERSION_STALE` and the version that landed. The editor
then asks: discard the draft and reload, or save anyway on top (an
explicit append, never a silent revert). Savers that pass no base — the
builder's autosave, an upload, MCP — append as before.
Deleting a skill removed the bundle and nothing else: every agent that
equipped it kept naming it, so its runs failed to start — and were
auto-retried three times over a configuration nothing could change — and
its dialog refused every save with PROJECT_AGENT_SKILL_UNKNOWN while the
skills menu listed nothing to untick (the deleted slug was simply absent).
The only way out was recreating a skill under the same slug.

A delete now unequips the slug from every agent of the organization in
its own transaction (both doors, still under the writer lock), audits it
as `skill.deleted` with the agents it touched, and answers how many. An
update validates only the equipment it ADDS, so a skill that was merely
unshared from the scope no longer blocks an unrelated edit, and the menu
lists such a skill as a checked "(unavailable)" entry the author can
untick. A run that cannot reach an equipped skill settles as
`equipment_missing`, which the auto-retry never re-kicks.
larryro added a commit that referenced this pull request Sep 26, 2026
The four container-test jobs (web, docs, ui-docs, AI gateway) ran under an
8-minute budget that the disk-reclaim step ahead of the test could eat by
itself on a slow runner (7 minutes on PR #3491's run), so the test was
cancelled before it ran and the check read as failed with nothing tested.
Fifteen minutes, the budget the image validation already has.
… last output

Every managed Codex run died in ~4 s with "The harness exited unexpectedly
(exit code 1)" and no log: the harness registry points CODEX_HOME at
/agent/.runtime/home/.codex, a directory the runtime entrypoint never
created, and the pinned Codex refuses to start when its home is missing —
on stderr only, before any JSON. The entrypoint now creates it, and the
image conformance test pins every harness state root a harness.yml names
under HOME to the entrypoint's list, and starts Codex against a present
root to see it announce its thread.

The harness window also kept nothing of stderr, so a crash could never
say why. The last few KB are kept and a window that exited without ending
the turn quotes the scrubbed tail in its reason ("Last output: …"), which
is what the run row and the failure comment show.
After "Try again" the view sits on a hidden sibling; an edit (or a second
retry) taken from it forked FROM that sibling at the same sequence, so the
lineage became a chain R -> B1 -> B2 and the navigator, letting the deeper
node win the sequence, showed [B1, B2] — the original turn was unreachable
and two retries lost the first reply.

- createBranchSibling hangs a fork at or before a sibling's own fork
  sequence off that sibling's parent (walking a legacy chain up), since
  the copied prefix is the parent's either way; branch-edit and
  branch-regenerate answer {id, parentId, forkSequence} and the client
  keys its selection, its optimistic override and the undo of a refused
  send on the returned fork point (restoring the previous choice there)
- forkGroupsForPath merges same-sequence groups along the path and
  follows same-sequence forks through their branches, so a lineage
  written before the flatten reads as one fork point too; the navigator
  writes the whole selection chain in one /branch-selection call
- the pure branch-selection module moves to lib/shared so the backend
  can walk the same map
- tests: the chain/regen scenarios in branch-selection.test.ts, the fork
  owner walk in threads.test.ts, the door's answer shape and the
  selection list body in routes.test.ts, an integration probe, manual
  box CHAT-F44
A share link was taken on the lineage root and its snapshot read the
root's own rows, so a chat with an edit or retry published the original
branch whatever the owner was looking at, and "Include newer messages"
re-stamped a root whose rows never change once a branch is active.

- migration 0114 adds app.thread_metadata.shared_thread_id (nullable)
- POST /threads/:root/share takes an optional leafThreadId; shareThread
  validates it (the root or one of its live siblings, same owner) or
  resolves the leaf from the stored selection map, and freezes it on the
  root row; getSharedThread reads the frozen sibling's rows under the
  root's token and falls back to the root when the sibling is gone
- the Share dialog passes the sibling on screen, so a republish
  re-freezes to the branch the owner is viewing; token, status and the
  Shared indicator stay on the root
- docs (en/de/fr) state the snapshot is the branch you are viewing;
  manual box CHAT-F45; an integration probe over the real schema
… list

A list whose read failed for good — three retries on a 500 or an aborted
request — rendered the collection's first-run empty state: "No projects
yet" for an organization with 26 projects, and one folder row with
"Showing all 1 document" on Documents. The design system already had the
table's error state with a retry; the shared list hook never carried a
request error and the page hooks dropped it.

`useListPage` now takes `error` and `retry` on either data source and hands
the table its error state (with the retry) when nothing is loaded — rows
already on screen outlive a failed refetch. The paginated listing hook and
the projects overview hook expose both; the projects and documents lists
pass them through. A read that errored on a fault (never a structured
refusal) is refetched again when the tab regains focus and when the hint
stream reconnects, so a list stuck on its error heals when the backend
does.
Team create and rename ride Better Auth's organization endpoints, member add and remove the app's own doors, and the SSO group sync writes teams and memberships on its own — only the app's delete door left an audit row. One vocabulary now covers all of them (backend/domains/teams/audit.ts): team.created, team.updated (old and new name, stashed by beforeUpdateTeam), team.deleted, team.member_added and team.member_removed, each in the transaction of the write it describes, or in the plugin hooks' own serializable transaction after the plugin's commit (the joined_organization posture, non-fatal). The plugin's add/remove-team-member doors are closed: nothing in the product calls them and they carried neither an audit row nor the last-member rule. Labels in en/de/fr, integration probes, and GOV-F29.
…dentials

Three credential kinds left no trace in the audit log: REST API keys (the @better-auth/api-key plugin has no hooks), WebDAV app passwords and connector credentials. The auth after-hook now classifies /api-key/create, /delete and /update into api_key.created / .revoked / .updated, one row per organization the holder belongs to through recordUserScopedSecurityEvent — the per-org fan-out the second-factor rows used, extracted so both share it — recording the key's start and last four characters, never the plaintext. The app-password doors write webdav_app_password.created (prefix only) and .revoked in the transaction of the row. The connector-credential service writes connector_credential.created / .updated / .deleted inside its own transactions, with set-default folded into an update on isDefault, naming the connector and auth method and never the secret or config; every door hands in the signed-in actor and a write without one is the system's. Labels in en/de/fr, one sentence in the API-key and WebDAV pages, integration probes, and AUTH-F25 to F27.
Branding saves, image uploads and removals wrote nothing to the audit log, and neither did anything a WebDAV client does to the document tree — a PUT, an overwrite, a COPY, a DELETE or a folder cascade — while the same writes through the UI were recorded. The branding writers now record branding.updated (with the fields that changed and both states), branding.image_uploaded and branding.image_deleted on the organization, inside the config write lock's transaction. The document vocabulary moves into backend/domains/documents/audit.ts so every door shares it: the upload, hub import, purge and UI folder cascade call the helpers where they wrote inline rows before, and the WebDAV handlers add document.created (PUT, COPY), document.updated (overwrite), document.trashed (DELETE — the row is in the Trash, not gone, so it is not document.deleted) and one folder.deleted per cascade with the count it trashed, each under the app-password owner with door=webdav. Labels in en/de/fr for the document, folder and branding rows, one sentence in the WebDAV and branding pages, an integration probe over the WebDAV flow, and GOV-F30.
The four container-test jobs (web, docs, ui-docs, AI gateway) ran under an
8-minute budget that the disk-reclaim step ahead of the test could eat by
itself on a slow runner (7 minutes on PR #3491's run), so the test was
cancelled before it ran and the check read as failed with nothing tested.
Fifteen minutes, the budget the image validation already has.
…teway's refusal

A turn's session key whitelists the serving model and the org's vision
model, and for most connectors they are one model. On the Anthropic lane
(Claude Code) the two land on different gateway records, but on the
OpenAI-wire lane they share one record and the whitelist carried
`deepseek-flash` twice — which the gateway refuses outright
("duplicate value … in whitelist"), so every managed Codex + DeepSeek run
died at the mint, before any harness ran, and the same refusal is the
likeliest reading of the evaluation's "mint key failed (400)" on other
models. Each spelling is whitelisted once per record.

The mint also threw only the status, so the run said "mint key failed
(400)" with nothing to act on; the gateway's own refusal text now rides
the error (bounded, never key material).
Every managed Codex + DeepSeek task run failed on its second model call.
Codex speaks the OpenAI Responses API to the gateway; for a custom
OpenAI-format connector the gateway serves a chat-only record and
translates Responses to chat completions. That translation cannot hand
the CLI a reasoning item it echoes back (Codex re-sends only `summary`
and `encrypted_content`; the translation emits neither), so a thinking
model's tool-loop turn replays without its reasoning and DeepSeek refuses
it: 400 "The `reasoning_content` in the thinking mode must be passed back
to the API". Reproduced with the pinned CLI through a recording proxy on
the gateway's v1.6.11 and on v2.2.3 alike — the gateway bump alone does
not fix it.

The same run completes on the connector's native Anthropic harness
endpoint (the `…__anthropic` record Claude Code already rides): the
gateway translates Responses to Anthropic and the loop stays intact.
Verified live on both gateway versions, spend readback included.

- Harness definitions declare the wire they speak on the managed lane
  (`gatewayWire`: anthropic | openai-chat | openai-responses; absent =
  derived from `ANTHROPIC_BASE_URL` as before). Codex declares
  `openai-responses`.
- Serving rides the Anthropic harness endpoint for an Anthropic-wire
  harness as before, and now for a Responses-wire harness on a connector
  the gateway would serve as a CUSTOM upstream. A standard gateway
  provider (openrouter) keeps its built-in record, which owns the
  Responses wire itself; chat-wire harnesses keep the OpenAI base.
- The gateway's standard-provider set moves to lib/shared so the serving
  resolver and the provisioner read one list.

On this door the model runs without extended thinking unless the harness
asks for a reasoning effort (Codex sends none for a gateway model).
A Codex turn the provider refused settled with the agent's last narration
sentence as the run's reason ("I'll start by inspecting …"): the parser
turned `turn.failed` into an `error` event nobody read, and the settle
fell back to the window's final text. The status the refusal carried was
lost with it, so the kick could not tell a 400 (a transcript the provider
refuses — start fresh) from a 429 (wait and resume).

- The Codex parser reads the provider status and sentence out of the
  gateway body the CLI hands back verbatim (`apiErrorStatus`, one-line
  message); any other message passes through as before.
- The window keeps the last failure the harness named; the end classifier
  carries it as the reason of a harness-reported error. A harness that
  only flags the error (Claude Code's `is_error`) still leaves its final
  words as the reason.
- Both hosts name a spend refusal (402) first, whichever way it arrived.
@larryro
larryro merged commit bc7e980 into main Sep 26, 2026
60 checks passed
@larryro
larryro deleted the fix/eval-0926-s2 branch September 26, 2026 14:16
yannickmonney added a commit that referenced this pull request Sep 26, 2026
Brings in #3490 and #3491. chat-surface.tsx takes main's new
branch-selection import path and fork comment; chatDraftKey stays in
lib/draft-key.ts, unchanged.

Main's round added CHAT-F44, NAV-F25, PROJ-F25, SET-F46, TASK-F19 and
TASK-B6 while this branch's unmerged boxes held the same IDs. Main's
boxes keep theirs; this branch's move to CHAT-F46, NAV-F41, PROJ-F28,
SET-F48, TASK-F28 and TASK-B7, and their references follow. The
conflicted suites' counts are recounted.
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