Skip to content

fix: utf-8 reads, cost-only csv/jsonl rows, cross-file copilot dedup#7

Merged
hamidi-dev merged 3 commits into
hamidi-dev:mainfrom
Gheat1:fix/stores
Jul 7, 2026
Merged

fix: utf-8 reads, cost-only csv/jsonl rows, cross-file copilot dedup#7
hamidi-dev merged 3 commits into
hamidi-dev:mainfrom
Gheat1:fix/stores

Conversation

@Gheat1

@Gheat1 Gheat1 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Three store correctness fixes (separate commits):

  • UTF-8 reads: every data-file open() relied on the locale encoding, so native Windows (cp1252) read transcripts as mojibake and split non-ASCII cwds into separate projects. encoding="utf-8" is now pinned on every user-data read (_read_text feeding the JSONL backends, csv/jsonl request logs, pi, openclaw, vscode, the availability probe), keeping existing errors= handling.
  • Cost-only rows: a CSV/JSONL row logging only cost_usd/credits with no token counts was dropped by the empty-row check β€” yet _probe_records_cost counted it, so the source claimed records_cost=True while showing $0. Rows with positive cost are now ingested; genuinely empty rows stay skipped.
  • Copilot cross-file dedup: the trace context, coverage sets, and seen keys were local to _parse_file, but OTEL exporters write spans and logs to different files β€” one call logged as a chat span in file A and an inference log in file B counted twice. Candidates are now collected across all files, then deduped and emitted at _parse scope, preserving the existing record-shape priority.

Tested: 3 new tests (cost-only csv row, cost-only jsonl line, span+log split across two files β†’ one row); suite 307/307, ruff clean.

Gheat1 added 3 commits July 7, 2026 16:42
Every data-file open() relied on the locale encoding, so native Windows
(cp1252) read transcripts and logs as mojibake and split non-ASCII cwds
into separate projects. Pin encoding="utf-8" on every read of user
data (the parallel-read helper feeding the JSONL backends, the csv/jsonl
request logs, pi, openclaw, vscode, the availability probe, and the
.git/wsl.conf/proc reads), keeping the existing errors= handling.
A row logging only cost_usd/credits (no token counts) was skipped by the
empty-row check, yet _probe_records_cost still counted it -- the source
claimed records_cost=True while showing $0. Ingest rows whose cost is
positive even with zero tokens; genuinely empty rows (no tokens AND no
cost) stay skipped.
The trace context, coverage sets, and seen keys were local to
_parse_file, but OTEL exporters write spans and logs to different files:
one call logged as a chat span in file A and an inference log in file B
was counted twice. Collect every file's candidates first, then dedup and
emit at _parse scope, preserving the chat span > inference log >
agent-turn log > agent-summary span priority. The trace/span/response
ids in the dedup keys are globally unique, so widening the scope never
merges distinct calls.
@hamidi-dev hamidi-dev merged commit df76f0a into hamidi-dev:main Jul 7, 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.

2 participants