Grade Qwen 6-bit on webhook prompt: 75/100 Minor Flaws (runs, all 4 tests pass)

Fourth data point on Qwen 3.6 35B-A3B 6-bit MLX:
  LFU cache    82  (runs)
  Webhook     75  (runs, all tests pass) <- best non-LFU result
  TTS pipeline 49  (doesn't parse)
  Rust service 50  (7 compile errors)

Profile sharpens: Qwen 6-bit handles SINGLE-HANDLER logic well
(webhook HMAC/idempotency/rate-limit/429-backoff all correct) but fails
on multi-task orchestration (TTS) and typed/compiled langs (Rust).
Safe offload for HTTP/bridge/verification work; not for pipelines or Rust.

Added webhook prompt_id + pillar set. (Initial paste was mangled -
stripped '=' signs - re-pasted clean.)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-28 18:03:50 -07:00
co-authored by Claude
parent e3d73de36a
commit 241298b410
3 changed files with 340 additions and 0 deletions
+39
View File
@@ -37,6 +37,10 @@
"automation": {
"label": "Automation Glue (idempotent batch)",
"file": "prompts/automation_glue.txt"
},
"webhook": {
"label": "Webhook Bridge (HMAC/idempotency/rate-limit)",
"file": "prompts/webhook_bridge.txt"
}
}
},
@@ -470,6 +474,41 @@
"Several `let _ = tx.send(...)` silently swallow channel-closed errors."
],
"patch_code": "// FIX 1 (the API hallucination): tokio mpsc has no bounded().\n// let (item_tx, item_rx) = mpsc::bounded(32);\nlet (item_tx, item_rx) = mpsc::channel(32);\n\n// FIX 2 (type mismatch):\ntokio::time::sleep(Duration::from_millis(20 + (id as u64 % 30))).await;\n\n// FIX 3 (ownership in shutdown): store JoinHandles in Option + take them,\n// and make shutdown take &mut self (or hold senders in Option):\nstruct WatcherEntry { status: WatcherStatus, consecutive_failures: u32, join_handle: Option<JoinHandle<()>> }\n// in shutdown: let handles: Vec<_> = inner.watchers.values_mut().map(|e| e.join_handle.take()).flatten().collect();\n// drop(self.item_tx.take()) etc. with Option<Sender> fields.\n\n// FIX 4 (remove_watcher must actually stop the task): either send on a per-watcher\n// oneshot/CancellationToken, or broadcast shutdown to that watcher's sub-channel.\n// Simplest: give each watcher a CancellationToken; remove_watcher cancels it, then awaits the handle.\n\n// FIX 5 (test isolation): inject the fetch fn into watcher_loop as a parameter so tests\n// can pass a failing mock; drop the dead global flag.\n// FIX 6: add `fn main() { ... }` or make it `cargo test`-only and document that."
},
{
"id": "qwen3.6-35b-a3b-6bit-mlx-webhook",
"prompt_id": "webhook",
"timestamp": "2026-07-29T01:05:00Z",
"model_name": "Qwen 3.6 35B-A3B",
"quant": "6-bit MLX",
"param_size": "35B-A3B (MoE)",
"format": "mlx",
"lang": "python",
"tok_sec": 69.24,
"total_tokens": 12595,
"ttft_sec": 0.95,
"filename": "outputs/qwen3.6-35b-a3b-6bit-mlx-webhook.py",
"tests_pass": true,
"total_score": 75,
"breakdown": {
"schema_io": 16,
"transport": 14,
"error_handling": 16,
"state_safety": 14,
"test_integrity": 15
},
"verdict": "Minor Logic Flaws",
"best_for": "Best non-LFU result for this model (75 vs TTS 49, Rust 50). Runs clean, passes all 4 tests, implements HMAC + idempotency + token-bucket rate-limit + 429 backoff correctly. Safe to offload single-handler HTTP/bridge logic (webhooks, signature verification, rate-limited forwarding). AVOID for multi-task orchestration (TTS) and typed/compiled languages (Rust).",
"critical_bugs": [
"Clock inconsistency: IdempotencyStore uses time.time() (system clock) while TokenBucketLimiter uses time.monotonic() \u2014 an NTP jump could wrongly expire/replay events. Should be monotonic everywhere.",
"No max-body cap: handle_client does reader.readexactly(content_length) with no limit \u2014 a hostile Content-Length could force a huge allocation (DoS). The rate limiter doesn't protect pre-parse.",
"forward_timestamps list grows unbounded (append-only, only cleared in tests) \u2014 memory leak for a long-running service.",
"HTTP reason phrase is the raw message string (HTTP/1.1 200 Forwarded) \u2014 works for the bundled test client but is not valid HTTP for real clients/proxies.",
"No Content-Type validation on incoming requests (accepts any).",
"Idempotency eviction is lazy (only on is_seen) \u2014 a quiet store retains stale entries until next access; not a leak in steady state but imperfect.",
"Tests are mildly timing-flaky: 5% random 429 in discord_send + a tight '>1.0s' threshold; no tests for the 400 (bad JSON) or missing-signature 401 paths even though the code handles them."
],
"patch_code": "# FIX 1 (clock): use monotonic for TTL too.\nclass IdempotencyStore:\n def is_seen(self, event_id):\n now = time.monotonic()\n ...\n def mark(self, event_id):\n self.store[event_id] = time.monotonic()\n\n# FIX 2 (body cap): reject oversized bodies before reading.\nMAX_BODY = 64 * 1024\ncontent_length = int(headers.get('content-length', 0))\nif content_length > MAX_BODY:\n writer.write(b'HTTP/1.1 413 Payload Too Large\\r\\nContent-Length: 0\\r\\n\\r\\n'); await writer.drain(); return\nbody = await reader.readexactly(content_length) if 0 < content_length <= MAX_BODY else b''\n\n# FIX 3 (leak): bound forward_timestamps (deque maxlen=N) or drop it if unused.\nfrom collections import deque\nself.forward_timestamps: deque = deque(maxlen=1000)\n\n# FIX 4 (reason phrase): use a fixed map.\nREASON = {200:'OK',400:'Bad Request',401:'Unauthorized',404:'Not Found',502:'Bad Gateway',500:'Internal Server Error'}\nresponse = f'HTTP/1.1 {status} {REASON.get(status,\"OK\")}\\r\\n...'\n\n# FIX 5: add tests for the 400 (malformed JSON) and missing-signature 401 paths."
}
]
}