Skip to content

Instantly share code, notes, and snippets.

View tonydzi's full-sized avatar

Anton Dziatkovskii tonydzi

View GitHub Profile
@tonydzi
tonydzi / RESULT.md
Created November 4, 2026 22:22
litellm#46543 red tests with green controls (ollama_chat stream tool call ids)

litellm main 9703e01c (04 Nov 2026), python 3.12, uv venv, editable install

Run on main, 3 times, same result each time (pytest -q, test file below): test_provider_tool_call_id_is_preserved FAILED test_two_provider_ids_preserved FAILED test_e2e_stream_over_http FAILED ('8caaa701-8ccf-436e-93c0-cdd4cf574c90' != 'call_8uaqob2r') test_missing_id_still_generated passed (control) test_incomplete_args_keep_args_control passed (control)

Same file with this change in OllamaChatCompletionResponseIterator.chunk_parser, run twice: 5 passed each time

@tonydzi
tonydzi / claude-voice-drift-what-worked.md
Created October 27, 2026 13:22
What worked for us against Claude-voice drift in character agents (for talkie-2)

What worked for us against Claude-voice drift

Context: a small fleet of agents (Claude, Codex, a few others) that write short texts on behalf of one person: posts, replies, DMs. Same disease talkie seems to have: synthetic data and model defaults pull every character toward the same polite, well-formed, assistant-shaped voice. Below is only what we measured and kept. Numbers are from our own runs, not a paper.

1. Measure the drift before you feel it

We dumped 30 drafts from three different models and counted surface features. 30/30 ended with a period. 0/30 used "!", "?" or "...". 11/30 opened with "Our". 11/30 used the "N of M" formula. First-person pronouns: 17.9 per 1000 words in the drafts, 50.1 in the author's own texts. None of this is "style", all of it is a fingerprint, and a ban-list of robot words did not move a single one of these counts. Measure first, then fix the thing that moved.

2. Tuning fork, not a style description

@tonydzi
tonydzi / codex-appserver-stdio-census.ps1
Created October 11, 2026 05:43
Read-only census of codex app-server stdio MCP children vs thread count (openai/codex#30408)
# codex-appserver-stdio-census.ps1 (read-only, Windows PowerShell 5.1+)
# For every running `codex.exe app-server`: direct children by launcher, thread
# count by wait reason, and how far it is from the 256-child ceiling that
# openai/codex#30408 (zhang8630, 2026-10-08) links to tokio's default
# max_blocking_threads = 512 (two blocking threads per idle stdio child).
# Kills nothing, writes nothing.
$all = Get-CimInstance Win32_Process
$servers = $all | Where-Object { $_.Name -eq 'codex.exe' -and $_.CommandLine -match 'app-server' }
if (-not $servers) { 'no codex app-server running'; exit 0 }
@tonydzi
tonydzi / claude-msix-update-evidence.ps1
Created October 9, 2026 05:54
Read-only check for Claude Desktop MSIX relaunch/update failures (claude-code#42776): prints how far back each event log can see, then Claude deploy versions, 658 deferrals, 215/208 activation failures
<#
claude-msix-update-evidence.ps1 - read-only check for the Claude Desktop (MSIX) relaunch/update failure
(anthropics/claude-code#42776). Answers two questions before you trust "it's fixed now":
1. How far back can this machine even see? (log retention, oldest record per log)
2. Inside that window: which Claude package versions were deployed, any deferred registration
(AppXDeploymentServer 658), activation failures (AppModel-Runtime 215/208), errors/warnings.
Changes nothing. No admin needed for the reads. Windows PowerShell 5.1+.
Optional: -Grow enlarges the two short logs so the next failure is still there when you look (needs admin).
#>
param([switch]$Grow)
@tonydzi
tonydzi / menurow.py
Created October 8, 2026 17:21
Which menu row did each memory save take: recalled / nearest-not-recalled / new. Replays a git-backed memory corpus, IDF-weighted min-normalised overlap at save time.
"""Which menu row did each save take: recalled / nearest-not-recalled / new.
Replays the git history of a memory corpus in order. For every save:
recalled = the writer modified a record that already existed
nearest-not-recalled = the writer ADDED a record while a near-match was already
in the corpus at that moment (the duplicate the session
could have seen and did not)
new = added with no near-match present
Scoring mirrors the bead filer's write-time prescreen: IDF-weighted token overlap
@tonydzi
tonydzi / jd_skills_gap.py
Last active October 8, 2026 17:30
JD keywords -> resume gaps: advisory three-bucket scorer (covered / missing_in_cv / unknown_hot), stdlib only, 12 offline tests
r"""jd_skills_gap.py - JD keywords -> gaps in a resume. Advisory, offline-testable, stdlib only.
Why this shape: ATS filters and recruiters match on words taken FROM THE JOB DESCRIPTION.
A tailoring pipeline that optimises a single percentage will happily "gain" skills the
person never had, and a score that moves 62% -> 88% by inventing Azure Functions is worse
than no score. So this reports three buckets instead of one number:
covered terms in the JD that the SELECTED resume variant already carries
(this is the evidence of a match, not a promise of one)
missing_in_cv terms in the JD that exist in a lexicon built from the union of the
@tonydzi
tonydzi / README.md
Created October 7, 2026 22:00
litellm#44979: 3 competing PRs, same 11 inputs, adapter → Gemini/OpenAI transforms

litellm #44979 — three competing PRs on the same 11 inputs

PRs: #44984, #45038, #45052. Each head checked out on its own base, editable install, no network. Pipeline per case: Anthropic body → LiteLLMAnthropicMessagesAdapter.translate_anthropic_to_openai → (a) _gemini_convert_messages_with_history, (b) OpenAIGPTConfig().transform_request. Run: python battery_44979.py inside the litellm checkout. Two runs per branch were byte-identical. Heads: main 127278f9 · #44984 591bb978 · #45038 ec7ffe3b · #45052 57b5c917 (2026-10-07).

@tonydzi
tonydzi / bu_both.py
Created September 27, 2026 20:30
browser-use 0.13.10: read_file content lives in <read_state> for exactly one step; only the 1000-char long_term_memory persists. A/B harness + a custom action that survives.
"""browser-use 0.13.10 — где живёт содержимое файла: <read_state> (1 шаг) vs history (навсегда).
Harness fix: history items are only appended when model_output is not None
(message_manager/service.py "Build the history item"), so we pass a real AgentOutput.
"""
import asyncio, csv, os, tempfile
from browser_use import Tools
from browser_use.agent.message_manager.service import MessageManager
from browser_use.agent.views import ActionResult, AgentBrain, AgentOutput, AgentStepInfo
from browser_use.filesystem.file_system import FileSystem
@tonydzi
tonydzi / headroom_1099_repro.py
Created September 27, 2026 20:21
headroom #1099 repro: technique=preserve reports (1-N)*100% 'saved' because original_tokens counts the FIRST image and compressed_tokens sums ALL images
"""Repro for headroom #1099 — "negative savings" under technique=preserve.
Root cause (headroom 0.39.1, commit d13e196), headroom/image/compressor.py:
line 254 _extract_image_data() -> docstring: "Extract FIRST image data from messages"
line 530 _apply_compression() -> for "preserve", returns messages UNCHANGED
line 730 original_tokens = _estimate_tokens(<FIRST image>) + tile_saved
line 738 compressed_tokens = _count_result_tokens(<ALL images in ALL messages>)
The two counters measure different sets, so with N images in the transcript the
@tonydzi
tonydzi / probe.py
Created September 23, 2026 16:50
pydantic-ai #8551: where the 'no usage object' signal dies (models/openai.py L5171-5173), and whether RequestUsage.details can carry it
"""Where does pydantic-ai lose the "provider sent no usage object" signal?
Context: pydantic/pydantic-ai#8551. Measured on pydantic-ai-slim 2.48.0,
openai 3.19.0, opentelemetry-sdk 1.44.0, Python 3.12, macOS.
Part 1 hits the real production mapper (pydantic_ai.models.openai._map_usage)
with three responses; C is the positive control and must differ from A.
Part 2 asks whether RequestUsage.details -- a field that already exists --
survives accumulation into RunUsage.
Part 3 asks whether it reaches the OpenTelemetry span attributes unaided.