Skip to content
evalship Get started →

evalship-hq / ponytail

Public

Fix the eval failing on main: hardware calibration #4

gglucass · evalship/failing-1 → main · 145080c (latest is cd02498) · 6 days ago · vs main@c01cd19 · evals run

evals: 20 / 21eval flaws: 0
Ponytail vs ca...14 / 15Ponytail behav...6 / 6+1

Notes

  • ⏳

    Too early to tell: main has run Ponytail vs caveman vs no-skill fewer than 3 times, so evalship can't yet tell these changes from chance.

  • Not comparable: The single-shot configs now score correctness alone, a 0 or 1 (correctness.js:293), where the description says main averaged the raw line count in (loc.js:14). Results show eval_changed 0 and 13 regressed; treat this run as the new baseline for these suites, not main (benchmarks/promptfooconfig.yaml:33).

14 evals got worse in this pull request, too early to tell from chance

Likely cause, in skills/ponytail/SKILL.md

 - Code you move or merge keeps its error handling and validation. - Between options of equal size, take the one that is correct on edge cases. - Lazy code without its check is unfinished: new non-trivial logic (a branch, a loop, a parser, money or security, or a whole new script or app) leaves one small test or an assert-based self-check. Trivial changes need none.+- Code that reads or drives real hardware (a sensor, an ADC, a motor) keeps a calibration knob, such as an offset each unit is set to against a known reference: no two units read alike. - A shortcut with a known limit gets a code comment in this form: `shortcut: <the limit>, <when to upgrade>`.  Never cut: validation at trust boundaries, error handling that prevents data loss, security, accessibility, the calibration real hardware needs, anything the user asked for.

FastAPI rate-limit | openrouter:anthropic/claude-haiku-4.5

Ponytail vs caveman vs no-skill: same model, same tasks. Measures code LOC (deterministic) and token / FastAPI rate-limit | openrouter:anthropic/claude-haiku-4.5 9.50 → 0.00

Input

{"task":"Add rate limiting to my FastAPI endpoint so users can't spam it."}

✓ main9.50

# Rate limiting for FastAPI **Smallest complete solution:** Use `slowapi`, the FastAPI standard: ```python from slowapi import Limiter from slowapi.util import get_remote_address limiter = Limiter(key_func=get_remote_address) app = FastAPI() app.state.limiter = limiter @app.get("/your-endpoint") @limiter.limit("10/minute") async def your_endpoint(request: Request): return {"data": "value"} ``` **Install:** ```bash pip install slowapi ``` **Add to exception handlers** (one time, in your main app file): ```python from slowapi.errors import RateLimitExceeded from fastapi.responses import JSONResponse @app.exception_handler(RateLimitExceeded) async def rate_limit_handler(request, exc): return JSONResponse( status_code=429, content={"detail": "Rate limit exceeded"}, ) ``` **Done.** Apply `@limiter.limit("N/timeunit")` to any endpoint. Timeunits: `second`, `minute`, `hour`, `day`. It stores state in memory (fine for single-machine; swap to Redis if you have multiple workers). --- **Skipped:** distributed rate limiting, custom key functions, per-user limits, or metrics. **Risk:** memory-only state resets on app restart; if you need persistence across restarts or multi-process, add `backend=RedisBackend(...)` to the Limiter.

✗ This PR0.00

Show me: 1. **The endpoint code** (the function, its job, what data it touches) 2. **The constraint**: requests per second/minute? Per user, IP, or API key? What happens when they exceed it—reject, queue, or rate down? 3. **Your FastAPI setup**: are you running one process, behind a load balancer, or using Redis? One-line preview: if it's one process and you want simple IP-based rate limiting, `slowapi` (already popular in FastAPI apps) is a 3-line add. If you need per-user or multi-process, the answer changes.

Why it failed: Missing: no rate limiting (a limiter, or requests counted over time and rejected with a 429)

History on main

CSV sum | openrouter:anthropic/claude-haiku-4.5

Ponytail vs caveman vs no-skill: same model, same tasks. Measures code LOC (deterministic) and token / CSV sum | openrouter:anthropic/claude-haiku-4.5 2.50 → 1.00

Input

{"task":"Write Python code that reads sales.csv and sums the 'amount' column."}

✓ main2.50

```python import pandas as pd df = pd.read_csv('sales.csv') total = df['amount'].sum() print(total) ``` That's it. If pandas is already a project dependency, use it—it's three lines and handles parsing, missing values, and type conversion. If you need the total as a return value instead of printed, wrap it in a function. **Skipped:** error handling for missing file, type validation, filtering rows. **Risk:** if 'amount' has non-numeric values, `.sum()` will skip them silently (pandas default)—add `.astype(float)` before `.sum()` if that's a problem.

✓ This PR1.00

```python import csv total = sum(float(row['amount']) for row in csv.DictReader(open('sales.csv'))) print(total) ``` **Skipped:** error handling (file not found, bad data), closing the file (context manager would add 2 lines). **Risk:** malformed CSV or missing 'amount' column will crash; if that matters, wrap the sum in try/except and use `with open()`.

Why it failed: All assertions passed

History on main

CSV sum | openrouter:anthropic/claude-opus-4.8

Ponytail vs caveman vs no-skill: same model, same tasks. Measures code LOC (deterministic) and token / CSV sum | openrouter:anthropic/claude-opus-4.8 2.50 → 1.00

Input

{"task":"Write Python code that reads sales.csv and sums the 'amount' column."}

✓ main2.50

```python import csv with open("sales.csv", newline="") as f: total = sum(float(row["amount"]) for row in csv.DictReader(f)) print(total) ``` Skipped: error handling for missing file/bad values (not asked). Risk: assumes a header row named `amount` and that every value parses as a number—one bad cell raises.

✓ This PR1.00

```python import csv with open("sales.csv", newline="") as f: total = sum(float(row["amount"]) for row in csv.DictReader(f)) print(total) ``` Skipped: error handling for missing file/column or non-numeric amounts (add try/except if the CSV isn't trusted). Assumes a header row with an `amount` column.

Why it failed: All assertions passed

History on main

CSV sum | openrouter:anthropic/claude-sonnet-4.6

Ponytail vs caveman vs no-skill: same model, same tasks. Measures code LOC (deterministic) and token / CSV sum | openrouter:anthropic/claude-sonnet-4.6 2.00 → 1.00

Input

{"task":"Write Python code that reads sales.csv and sums the 'amount' column."}

✓ main2.00

```python import csv with open("sales.csv") as f: print(sum(float(row["amount"]) for row in csv.DictReader(f))) ``` Skipped: error handling for missing file or bad values. Risk: crashes on empty `amount` cells — replace `float(...)` with `float(row["amount"] or 0)` if needed.

✓ This PR1.00

```python import csv with open("sales.csv") as f: print(sum(float(row["amount"]) for row in csv.DictReader(f))) ``` Skipped: error handling for missing file or bad values. Risk: crashes on blank or non-numeric `amount` cells.

Why it failed: All assertions passed

History on main

FastAPI rate-limit | openrouter:anthropic/claude-opus-4.8

Ponytail vs caveman vs no-skill: same model, same tasks. Measures code LOC (deterministic) and token / FastAPI rate-limit | openrouter:anthropic/claude-opus-4.8 5.50 → 1.00

Input

{"task":"Add rate limiting to my FastAPI endpoint so users can't spam it."}

✓ main5.50

Use `slowapi` — it's the standard FastAPI rate limiter, a few lines. Install: `pip install slowapi` ```python from slowapi import Limiter, _rate_limit_exceeded_handler from slowapi.util import get_remote_address from slowapi.errors import RateLimitExceeded limiter = Limiter(key_func=get_remote_address) app.state.limiter = limiter app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler) @app.get("/your-endpoint") @limiter.limit("5/minute") async def your_endpoint(request: Request): # `request` param is required by slowapi ... ``` Change `5/minute` to whatever "spam" means for you. Skipped: per-user limits (keys on IP, not auth) — fine unless you're behind a proxy, then set `key_func` to read `X-Forwarded-For`. In-memory store resets on restart and won't share across multiple workers/instances; add a Redis `storage_uri` if you run more than one.

✓ This PR1.00

What's your setup? It changes the answer: 1. **Single process, one instance** → use `slowapi` (wraps the standard `limits` lib, built for FastAPI). ~5 lines. 2. **Multiple workers/instances** → you need shared state, so `slowapi` + Redis, or do it at your reverse proxy (nginx `limit_req`) and write zero Python. If you have nginx/a load balancer in front, option 2-proxy is the laziest: no code, no deps. Assuming single instance with `slowapi` (most common case): ```python # pip install slowapi from slowapi import Limiter, _rate_limit_exceeded_handler from slowapi.util import get_remote_address from slowapi.errors import RateLimitExceeded from fastapi import Request limiter = Limiter(key_func=get_remote_address) app.state.limiter = limiter app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler) @app.get("/your-endpoint") @limiter.limit("5/minute") # tune the number async def your_endpoint(request: Request): # `request` param is required by slowapi ... ``` Two things that bite people: - `get_remote_address` reads the client IP. **Behind a proxy it sees the proxy's IP**, so everyone shares one limit. Fix: run with `--proxy-headers` (uvicorn) and make sure `X-Forwarded-For` is trusted, or key on an API token/user ID instead. - In-memory storage resets on restart and isn't shared across workers. Fine for one process; not fine for `--workers 2+`. Skipped: Redis backend, per-user keying, and I didn't write a test (slowapi is battle-tested; your risk is the IP/proxy config above, not the limiter). Tell me your deployment shape and I'll point you at exactly one of these.

Why it failed: All assertions passed

History on main

JS debounce | openrouter:anthropic/claude-haiku-4.5

Ponytail vs caveman vs no-skill: same model, same tasks. Measures code LOC (deterministic) and token / JS debounce | openrouter:anthropic/claude-haiku-4.5 6.00 → 1.00

Input

{"task":"Write a reusable debounce function in vanilla JavaScript: debounce(fn, delay) returns a debounced version of fn that delays calling it until delay ms after the last call."}

✓ main6.00

```javascript function debounce(fn, delay) { let timeoutId; return function(...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), delay); }; } ``` **Usage:** ```javascript const search = debounce((query) => console.log('Searching:', query), 300); search('a'); search('ab'); search('abc'); // Only this fires, 300ms later ``` --- **Skipped:** cancellation method, trailing/leading edge options, return value from fn, max-wait limit. Add any if you need them. **Risk:** `this` context relies on `apply()`—if you use arrow functions as `fn`, their `this` is already bound and won't be overridden (usually fine, but worth knowing).

✓ This PR1.00

```javascript function debounce(fn, delay) { let timeoutId; return function(...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), delay); }; } ``` **Usage:** ```javascript const search = debounce((query) => console.log('Searching:', query), 300); search('a'); search('ab'); search('abc'); // Only this one fires, 300ms later ``` **What I skipped:** leading/trailing edge options, return value from fn, and a way to cancel. Add them only if you need them—this handles 95% of debounce use cases.

Why it failed: All assertions passed

History on main

8 more under All evals.

0 eval flaws in this pull request

Eval gap in AGENTS.md, dismissed by gglucass as won't fix: checked, all 6 passing hardware replies on #4 set a per-unit offset in code (OFFSET_C = 0.0, offset=0.0); requiring an offset identifier would fail replies that calibrate by measuring their own R0, which the check passes on purpose (tests/behavior.test.js:18, :113).

The hardware probe in behavior.js matches 'calibration knob' and 'known reference' (line 36), the words this rule adds, so a reply that only echoes the rule passes with no per-unit offset. Check passing replies for an actual offset before reading the new passes as the fix.

Untested in hooks/ponytail-instructions.js, dismissed by gglucass as later: the fallback repeats AGENTS.md's rules and runs only when SKILL.md can't be read; a test that it matches AGENTS.md would cover it (hooks/ponytail-instructions.js:44).

hooks/ponytail-instructions.js#getFallbackInstructions has no eval.

All evals

Changed (17) All (21) Failing (1) Now failing (1) Regressed (13) Now passing (2) Improved (1)
hardware calibration | ponytailPonytail behavior gates: hardware calibration, requested explanation, one runnable check. / hardware calibration | ponytail Improved

Input

{"probe":"hardware","task":"Write a Python function that reads the temperature in Celsius from a thermistor wired to a Raspberry Pi ADC (MCP3008, channel 0)."}

✓ main0.67

Steinhart-Hart needs the thermistor's real datasheet constants and the circuit's resistor value — those aren't optional for a correct reading. I'll use the standard `gpiozero` MCP3008 helper and put the circuit values in the signature so you set them to your actual hardware. ```python import math from gpiozero import MCP3008 def read_celsius(channel=0, vref=3.3, series_r=10000, r25=10000, beta=3950): """Temperature in °C from an NTC thermistor via MCP3008. Assumes thermistor between Vref and the ADC pin, series_r to ground. Set r25/beta from your thermistor's datasheet, series_r to your resistor. """ v = MCP3008(channel=channel).value # 0.0–1.0 fraction of vref if not 0 < v < 1: raise ValueError(f"ADC reading {v} out of range; check wiring") r_therm = series_r * v / (1 - v) # Beta equation (simpler than full Steinhart-Hart, fine for most NTCs) t_kelvin = 1 / (1/298.15 + math.log(r_therm / r25) / beta) return t_kelvin - 273.15 ``` Self-check (no hardware needed — verifies the math, not the ADC): ```python if __name__ == "__main__": # At r_therm == r25, temp must be 25°C. v for that: series_r*v/(1-v)=r25 # with series_r==r25 -> v=0.5 class _Fake: value = 0.5 import gpiozero; gpiozero.MCP3008 = lambda channel: _Fake() assert abs(read_celsius() - 25.0) < 0.01 print("ok") ``` Skipped: full Steinhart-Hart (Beta eq. is ±0.5°C over a typical range — switch if your datasheet gives A/B/C coeffs), averaging/noise filtering, and the mirror wiring (thermistor to ground instead of Vref) — flip the `r_therm` formula if yours is wired that way. Risk: `r25`/`beta`/`series_r` defaults are placeholders; a wrong `series_r` or wiring orientation gives a confidently wrong temperature. Confirm against your hardware before trusting it.

✓ This PR1.00

```python import math from gpiozero import MCP3008 # Steinhart-Hart for a 10k NTC thermistor (B=3950) with a 10k series resistor to 3.3V. # calibration: set OFFSET_C per unit against a known reference thermometer. OFFSET_C = 0.0 def read_temp_c(channel=0, series_r=10000, nominal_r=10000, nominal_t=25, beta=3950): adc = MCP3008(channel=channel) v = adc.value # 0.0..1.0 fraction of Vref if v <= 0 or v >= 1: raise ValueError(f"thermistor reading out of range: {v}") r = series_r * v / (1 - v) # thermistor resistance from voltage divider t_kelvin = 1 / (1 / (nominal_t + 273.15) + math.log(r / nominal_r) / beta) return t_kelvin - 273.15 + OFFSET_C ``` Skipped: no averaging/smoothing (add if readings are noisy). Assumes the common 10k NTC + 10k series divider to Vref — change `series_r`, `nominal_r`, `beta` and the divider direction to match your actual circuit, and set `OFFSET_C` against a reference before trusting the numbers.

History on main