Skip to content

Instantly share code, notes, and snippets.

@donpark
donpark / idfon-toolcalling-budget-tag-report.md
Created September 16, 2026 21:25
pi tool-calling failure: malformed budget tag and XML tool-call loop

pi tool-calling failure: model emits XML tool syntax and loops on <budget:token_budget>

Summary

In pi coding agent 0.85.1, using Vercel AI Gateway with deepseek/deepseek-v4.1-flash at thinking level medium, the model can abandon pi's native tool-call format and emit Anthropic/XML-style tool markup as ordinary assistant text:

<function_calls>
<invoke name="bash">
...
@donpark
donpark / idfon-openrouter-h2-error-report.md
Created September 15, 2026 18:35
openrouter / deepseek-v4.1-flash: 12x upstream Together h2 protocol stream errors (pi 0.85.1)

OpenRouter + deepseek/deepseek-v4.1-flash: repeated HTTP/2 stream errors from upstream Together

Summary

While using openrouter serving deepseek/deepseek-v4.1-flash (API mode openai-completions) the stream repeatedly dies mid-reasoning with the OpenRouter error:

Upstream error from Together: Stream error: h2 protocol error: error reading a body from connection
@donpark
donpark / idfon-vercel-gateway-glitch-report.md
Created September 15, 2026 18:26
vercel-ai-gateway / deepseek-v4.1-flash: runaway tool-tag repetition loop in reasoning channel (pi 0.85.1)

Gateway/provider glitch: runaway tool-tag repetition loop in reasoning channel

Summary

Via vercel-ai-gateway serving deepseek/deepseek-v4.1-flash with thinking level high, the model sporadically enters a decoding loop while emitting tool-call markup inside the reasoning/thinking channel. After writing a normal <parameter>…</parameter> block it never closes the call, and instead emits a constant 23-byte cycle forever:

@donpark
donpark / watchman-metro-macos-upgrade-bug.md
Created April 10, 2026 06:12
Metro 'Unable to resolve module' after macOS reboot — a watchman state bug

Metro "Unable to resolve module" after macOS reboot — a watchman state bug

If you're an Expo or React Native developer and Metro suddenly can't resolve modules after a macOS reboot (or upgrade), watchman's stale state is likely the cause.

Symptoms

After rebooting (or upgrading) macOS, Metro fails with:

Unable to resolve module ./node_modules/expo-router/entry
@donpark
donpark / ClearViewApp.swift
Created May 3, 2025 17:15
macOS window with see-through background.
//
// ClearViewApp.swift
// ClearView
//
// Created by Don Park on 5/3/25.
//
import SwiftUI
@main
@donpark
donpark / README.md
Last active April 30, 2025 22:39
SwiftUI ZoomableImage

I needed a zoomable image view in SwiftUI that allows user to pan and zoom the image with useful constraints like:

  • snap back zoom in beyond 3x
  • snap back zoom out beyond entire image is visible
  • snap back pan beyond image bounds.

TODO:

  • Add rotation support
@donpark
donpark / react-query.md
Last active July 9, 2024 04:19
Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.
Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components.
Classes or null prototypes are not supported.

When above error is thrown in React 14+, root cause may be QueryClientProvider not being defined in client scope using "use client".

Solution for Next.js apps using App Router

@donpark
donpark / DOM3D.js
Created March 27, 2024 10:41 — forked from OrionReed/dom3d.js
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@donpark
donpark / claude-journalist.md
Created March 26, 2024 16:25
claude-journalist prompts

get search terms to query SERP with (haiku)

You are a world-class journalist. Generate a list of 5 search terms to search for to research and write an article about the topic.

Please provide a list of 5 search terms related to '{topic}' for researching and writing an article. Respond with the search terms in a Python-parseable list, separated by commas.

select relevant urls among SERP results (haiku)

@donpark
donpark / test-1.md
Created March 14, 2024 00:50
news-despin tests
$ llm chat -m gpt-4-turbo-preview
Chatting with gpt-4-turbo-preview
Type 'exit' or 'quit' to exit
Type '!multi' to enter multiple lines, then '!end' to finish
> !multi

You are seasoned news editor famous for identifying and removing political spin from news articles.