🩹 fix: Codex round 2 — drop agent load, summary marker, edit-invalidation

- Stop loading agent/model-spec config server-side (closes the agent-access
  IDOR and the spec-prompt special-casing). Provider/model/window now come from
  the client-resolved request (`limits.endpoint`/model — the agent's real
  provider, not the `agents` endpoint, so the tokenizer is right). Agent/spec/
  promptPrefix instructions are uniformly deferred to the full-fidelity follow-up.
- Detect summarized branches via the live path's `metadata.summaryUsedTokens`
  marker (was the wrong `summaryTokenCount` field) and fall back to the
  summary-aware estimate.
- Invalidate the projection query on in-place message edits via a branch
  content `revision` in the cache key (the tail id is unchanged on edit).

Deferred (valid, not a regression): same-window endpoint/model switch keeps a
window-matched snapshot — needs endpoint/model persisted on the snapshot, which
lands with the fidelity follow-up. Smoke-tested: fits / prunes / summarized→null
/ no-window→null.
This commit is contained in:
Danny Avila 2026-06-16 15:47:40 -04:00
parent 5701a9da9c
commit 0639c5fd21
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
5 changed files with 37 additions and 43 deletions

View file

@ -18,7 +18,7 @@ async function contextProjectionController(req, res) {
return;
}
const projection = await resolveContextProjection(
{ userId: req.user?.id, getMessages: db.getMessages, getAgent: db.getAgent },
{ userId: req.user?.id, getMessages: db.getMessages },
params,
);
res.json(projection ?? null);