Skip to content

refactor(core): tail migrations — hermes, warp, cursor-agent, quickdesk, devin (phase 8, sqlite batch 2) - #834

Merged
iamtoruk merged 1 commit into
feat/core-extractionfrom
phase8/sqlite-batch2
Jul 27, 2026
Merged

refactor(core): tail migrations — hermes, warp, cursor-agent, quickdesk, devin (phase 8, sqlite batch 2)#834
iamtoruk merged 1 commit into
feat/core-extractionfrom
phase8/sqlite-batch2

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Phase 8 sqlite batch 2 (tracking #809): migrates the row→call decode for hermes, warp, cursor-agent, quickdesk, devin into @codeburn/core per the recipe's sqlite variant — driver, SQL, blobToText, sqlite_master probing, and busy-error handling all stay CLI-side; only pure row decode, types, and tool maps move.

Two-tier protocol (Kimi draft → independent Opus arm-by-arm validation vs the pre-migration originals). The validator found and fixed 10 defects the green suites missed, notably:

  • warp: Record tool-map rewrite reintroduced the batch-1 prototype-member leak; safeNumber rewritten to accept numeric strings/negatives (feeds token budgets + dominant-model selection). Both restored exactly.
  • quickdesk: inverted source-routing predicate sent sessions.db/metrics sources to the wrong parser. Restored.
  • devin: core reimplemented getShortModelName as a Claude-only regex (user-visible display bug for every non-Claude id) — display resolution moved back CLI-side, core emits raw ids; plus a spurious costBasis: 'measured' the original never emitted.
  • cursor-agent: lost "unrecognized transcript format" stderr warning restored via the decode-wrapper pattern; per-source attribution-DB reopen restored to per-conversation cache; session-id derivation single-sourced.

Golden authenticity independently re-derived by running the fixtures through the extracted pre-migration originals: this caught that devin's golden had been captured from the draft, not the original — after correction, 15/15 reproduce field-for-field under both implementations. All goldens are full-object toEqual pins.

stderr parity verified site-by-site (hermes 4, warp 2, cursor-agent 1 restored, quickdesk/devin none). All five carry userMessage: arch-gate allowlist + content-smuggling blocks added for each.

Gates: core 317/317; CLI suite from packages/cli and root npm test both 2345 passed, 5 skipped; no parse-version changes; shared wiring files merged as add-only unions with batch 1.

Pre-existing (untouched, flagged): bare-Record lookup maps in hermes/quickdesk/cursor-agent/warp originals share the prototype-exposure class — candidates for one sweep fix later alongside gooseToolNameMap.

…sk, devin (phase 8, sqlite batch 2)

Move the pure record decode for five sqlite-backed providers into
@codeburn/core, keeping discovery, sqlite I/O, pricing, and bash
base-name extraction CLI-side behind the dual-registry bridge.

sqlite variant: the host opens the database, runs the SQL, textualizes
BLOBs (warp stylized_command, quickdesk content/tool_names), probes
sqlite_master table variants (quickdesk), and re-throws SQLITE_BUSY so a
transient lock on a live database retries instead of being cached as an
empty result (hermes). The core decoders receive already-normalized rows.

Validator fixes over the drafted migration (original behavior is the
authority in every case):

- warp: restored the `run_command` tool-name check as an identity
  comparison. The draft had rewritten it as a bare Record lookup, so
  'constructor'/'toString'/'__proto__' resolved to inherited Object
  members instead of passing through. Added a regression test.
- warp: restored `safeNumber` to the host's semantics (positive finite
  numbers only). The draft's rewrite accepted numeric strings and
  negative values, changing token budgets and dominant-model selection
  for untrusted conversation_data.
- warp: `estimateTokensFromChars` now mirrors the host helper exactly.
- devin: model DISPLAY names move back CLI-side. The draft shipped a
  7-line regex standing in for the host's `getShortModelName`, which
  mis-rendered every non-Claude model id. The decoder now emits the raw
  generation_model / model_name ids and the CLI formats them.
- devin: dropped the added `costBasis: 'measured'`; the pre-migration
  call carried `costUSD` with no basis marker. Golden corrected.
- quickdesk: fixed an inverted source-variant predicate that routed
  `sourceId: 'metrics'` on a sessions.db path (and `sourceId:
  'sessions-db'` on a metrics path) to the wrong parser.
- cursor-agent: the "unrecognized transcript format" warning is now
  re-emitted from the real decode result via a decode wrapper. The draft
  re-derived `recognized` host-side as `hasUser && hasAssistant`, which
  silently dropped the warning whenever a jsonl transcript had both roles
  but produced no turns.
- cursor-agent: restored the per-conversation summary cache, so the
  attribution database is opened once per conversation id, not per source.
- cursor-agent/devin: the session id is derived once, host-side, and
  passed through, removing a second derivation that could disagree with
  the host's on Windows-style paths.
- hermes: `browser_vision` maps to Vision, matching the original table.

Goldens re-verified by running each bridge fixture through the
pre-migration provider implementation: all five reproduce field-for-field.
@iamtoruk
iamtoruk merged commit 5b7ea74 into feat/core-extraction Jul 27, 2026
4 checks passed
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