Skip to content

Add bad-output feedback loop to Prompt Token Saver#29

Merged
alekslinde merged 2 commits into
mainfrom
feature/token-saver-feedback-loop
Jun 11, 2026
Merged

Add bad-output feedback loop to Prompt Token Saver#29
alekslinde merged 2 commits into
mainfrom
feature/token-saver-feedback-loop

Conversation

@alekslinde

Copy link
Copy Markdown
Owner

Summary

  • Users can now report bad compression results directly from the tool — a "Bad output? Report it" link appears below the output after each compression, expanding to an optional 280-char note field before submitting
  • Reports are stored in a new FeedbackStore Durable Object (SQLite) so they can be retrieved as a training corpus to improve the compression dictionaries over time
  • Abuse prevention is layered: origin check (lindetoolbox.com only), payload size limits (10–2000 chars), per-IP+content-hash deduplication per day (same prompt can't be submitted twice by the same person), and a hard cap of 10 reports/IP/day
  • No PII is retained — IPs are SHA-256 hashed before storage and the hash is not stored alongside raw text
  • Admin corpus retrieval via GET /feedback requires a Bearer token (FEEDBACK_SECRET Worker secret, already set)

Test plan

  • Compress a prompt → "Bad output? Report it" link appears below output
  • Click link → form expands, button hides
  • Submit with no note → 200, success message shown, form collapses
  • Submit the same prompt again → 409 "Already reported." shown
  • Submit 10 reports from same IP → 11th returns 429 "Too many reports today."
  • curl https://lindetoolbox.com/feedback with no token → 401
  • curl https://lindetoolbox.com/feedback -H "Authorization: Bearer <secret>" → JSON rows array
  • Click Clear → feedback area hides; re-compressing shows fresh form
  • Request from non-lindetoolbox origin → 403

Adds a FeedbackStore Durable Object (SQLite) and POST /feedback endpoint
to collect bad compression reports from users. Reports are deduplicated by
IP+content hash per day and capped at 10/IP/day to prevent abuse. GET
/feedback requires a Bearer token (FEEDBACK_SECRET env var) for admin
retrieval of the corpus.

UI shows a thumbs-down link below the output after each compression;
clicking it reveals an optional 280-char note field before submitting.

Also fixes auto-branch.sh rename mode: sed was missing -E flag so the
(current|this) alternation was treated as a literal string.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
lindetoolbox 598e662 Jun 11 2026, 01:48 PM

@alekslinde alekslinde merged commit 5db35f1 into main Jun 11, 2026
2 checks passed
@alekslinde alekslinde deleted the feature/token-saver-feedback-loop branch June 11, 2026 13:57
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.

1 participant