Skip to content

fix(call-logs): record encrypted reasoning presence, duration and effort - #14680

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.51from
maxmad64bis:fix/reasoning-encrypted-observability
Sep 24, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.51from
maxmad64bis:fix/reasoning-encrypted-observability

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #14547 — release/v3.8.51 tip fails typecheck on files outside this PR (auggie.ts, projectCombo.ts); unit shards fail identically on the bare base. No docs touched.

Summary

Record encrypted reasoning presence, duration and requested effort in call logs: Responses upstreams that encrypt their reasoning left call logs blind (reasoning columns stayed NULL because the chat-shaped response body never carries the opaque item). Raw output-item events are observed in both stream loops and terminal snapshots are scanned at the save sink so streaming and non-streaming paths are covered. Additive only: four nullable columns, readers and cost math unchanged.

Related Issues

No linked issue — observational gap found while diagnosing long stalls on a Responses upstream; no existing issue covers encrypted-reasoning observability.

Validation

  • Change type: DB
  • Focused tests and category gates from the golden path
  • npm run lint — clean on the touched files (exit 0 with suppressions); the full run is red on the base (🔴 Release branch not green: release/v3.8.51 #14547)
  • Reconciled with the current active release base; focused checks rerun afterward — base release/v3.8.51 tip 7d23bcf8ec, rev-list HEAD..base = 0; file-size/complexity/eslint/unit/numbering rerun on the rebased tree
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/call-logs-reasoning-encrypted.test.ts (new, 5 tests: sink flag, NULL baseline, usage intact, stream meta with duration and efforts, pure observer).

Coverage Notes

  • Migration plus sink and stream observer are covered by the new test and the neighbouring reasoning-token-source-6187 suite (11 green locally). Cost math untouched.

Reviewer Notes

  • Rebased on the tip: migration renamed 186 → 187 (the tip already carries 186_conversation_turn_nodes_last_seen_index.sql); numbering gate passes (184 migrations, 0 duplicates).
  • Migration is additive (ADD COLUMN, nullable) with self-heal for divergent lineages; never stores encrypted content, signatures, or payloads — flag, duration and effort values only.
  • File-size rebaseline included (stream.ts 3239→3296, new observer module under cap; chatCore.ts +3 under its freeze).

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Careful piece of work, especially on the security side: I traced the request-body
plumbing (clientRequestBody/upstreamRequestBody) all the way through and
confirmed only the extracted reasoning_effort string ever reaches the DB row —
never the encrypted blob itself, exactly as your module comment promises. I also ran
tests/unit/call-logs-reasoning-encrypted.test.ts in an isolated worktree against a
real SQLite instance: 5/5 pass. Migration 186 is the correct next number on the
current tip, no collision. Good to merge.

Responses upstreams that encrypt their reasoning left call logs blind:
reasoning columns stayed NULL because the chat-shaped response body never
carries the opaque item. Raw output-item events are observed in both stream
loops and terminal snapshots are scanned at the save sink; four nullable
columns carry flag, duration and effort, readers and cost math unchanged.
Migration 187 (base tip already carries 186); covered by
tests/unit/call-logs-reasoning-encrypted.test.ts (5/5).
@maxmad64bis
maxmad64bis force-pushed the fix/reasoning-encrypted-observability branch from a3566ba to 0d72161 Compare September 24, 2026 11:22
# Conflicts:
#	config/quality/file-size-baseline.json
@diegosouzapw
diegosouzapw merged commit 4e77ceb into cheaper-inference:release/v3.8.51 Sep 24, 2026
4 of 7 checks passed
@maxmad64bis
maxmad64bis deleted the fix/reasoning-encrypted-observability branch September 24, 2026 21:15
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.

2 participants