Public thread anyone can reply to

merged…
osebo50d ago

Can you make to a public thread can also be marked as anyone without an account can reply

7 repliesoldestnewest
Osebotfable-5-150d ago

Plan: add a second, opt-in flag on public threads — anyone can reply — so a thread that's already public can also take replies from visitors without an account.

  • threads.anyone_can_reply boolean (drizzle/0007, default false). Only meaningful while public is true; making a thread sign-in-only clears it.
  • PATCH /api/threads/[id] accepts { public?, anyoneCanReply? } (creator or workspace owner, same canManageThread rule). Setting anyoneCanReply: true on a private thread is a 400.
  • POST /api/threads/[id]/posts lets an anonymous request through when the thread is public + anyone-can-reply. Guest posts get author_user_id = null, author_name = an optional display name (sanitised, ≤40 chars, default "guest") and meta.guest = true. Guests can never tick Ask Claude, attach images, or start/fork threads; body capped at 4k chars.
  • Thread page: anonymous visitors get a slim guest Composer (name field + textarea, no run/model/attach controls). Guest posts render with a "guest" badge; the agent prompt marks them guest="true" so Claude knows the author is unverified.
  • ThreadVisibility gains a second control next to "public": "sign in to reply · let anyone reply" (two-tap, like going public) / "anyone can reply · require sign-in".

No webhooks, no notification changes. I'll screenshot the meta line + guest composer with a static mockup.

Osebotfable-5-150d agothreadide@f308f04

Done — PR #57, branch thread/b5d355e8, commit f308f04.

What you get

A public thread can now also be marked anyone can reply. Visitors with no account then see a slim guest composer (optional name + textarea) and can post plain replies; everything else (new threads, Ask Claude, fork, image uploads) still needs a session.

In the thread's meta line (creator or workspace owner only), next to the existing public/sign-in-only switch:

  • sign in to reply · let anyone reply → two-tap (red confirm, 4s), like going public
  • anyone can reply · require sign-in to reply → one tap back
  • Switching the thread back to sign-in only also turns guest replies off (server side), so a private thread can never accept anonymous posts.

Everyone else sees public · anyone can reply as plain text. Guest posts carry a dashed GUEST badge and the name is self-declared; Claude's prompt tags them guest="true" so it doesn't treat an anonymous "osebo" as you.

How it's built

  • DB: threads.anyone_can_reply boolean, default false (drizzle/0007_anyone_can_reply.sql + journal). Runs on the prod build when the PR merges, like 0006 did.
  • API: PATCH /api/threads/[id] takes { public?, anyoneCanReply? } (same canManageThread rule); anyoneCanReply: true on a private thread → 400. setThreadPublic became setThreadVisibility in lib/data.ts.
  • Posting: POST /api/threads/[id]/posts no longer hard-requires a session. With none, requireThreadGuestWriter (lib/session.ts) lets it through only when public + anyone-can-reply (401 otherwise). Guest posts: author_user_id NULL, author_name = sanitised name (lib/guest.ts: ≤40 chars, <> stripped, default guest), meta.guest = true, body ≤4k, askClaude/attachments rejected with 403. addHumanPost re-checks all of this so a route bug can't let a guest start a run.
  • UI: Composer has a guest prop (name field persisted in localStorage, no run/model/attach controls, "Post as guest"); it now also shows the API error under the form instead of silently failing — useful when an owner flips the flag off mid-draft. ThreadVisibility grew the second control. CSS: .badge.guest, .guest-name input, .compose-error.

Not covered / worth knowing

  • No rate-limiting or captcha on guest posts — the thread owner is the spam control (flip it off). If a public thread gets abused, add a per-IP limit in the posts route.
  • Guest replies still run through the triage decider and get embedded like any human post, so Claude can retrieve them as context later (tagged as guest).
  • Verified with tsc only (no DB/OAuth in the sandbox); the screenshot is a static mockup on the real stylesheet.
Left: owner's meta line with the new "anyone can reply" toggle and a guest post badge. Right: anonymous visitor's guest composer (static mockup on real globals.css, 390px).
Left: owner's meta line with the new "anyone can reply" toggle and a guest post badge. Right: anonymous visitor's guest composer (static mockup on real globals.css, 390px).
oseboasked Osebot50d ago

And this will work in replies with Claude?

Osebotfable-5-150d ago

Yes — with one deliberate limit. On the current branch (f308f04):

What works for guests + Claude

  • Claude sees guest replies. They're regular human posts in the thread, so every run reads them in the transcript (lib/context.ts), tagged guest="true" so Claude knows the author is an anonymous visitor and not a verified member.
  • Claude can answer a guest. Any member clicks Ask Claude (or Fork) on the guest's post — the existing per-post run route (…/posts/[postId]/run) works on guest posts like any other; the triage tier was already computed when the guest posted.
  • Guests see Claude reply live. The SSE stream (/api/threads/[id]/events) uses requireThreadReadable, which lets anonymous visitors in on public threads, so the "Claude is working…" strip and the new post appear for them without reloading.
  • Guest posts also get embedded + decider-triaged like normal, so Claude can retrieve them as context in other threads later (still tagged guest).

What doesn't (on purpose)

  • A guest can't trigger a run themselves — the guest composer has no Ask Claude checkbox and the API 403s askClaude without a session (addHumanPost re-checks this too). Reason: a run is ~45 min of sandbox + model time on your GitHub token, with push access to your repos; opening that to anyone on the internet with no account and no rate limit is a spam/cost hole. So today: guest asks → a member presses Ask Claude → Claude replies, visible to the guest.

Want guests to summon Claude directly? If so, tell me which shape and I'll add it on this branch:

  1. Owner toggle — a third switch, "guests can ask Claude", off by default, only on public + anyone-can-reply threads. Plus a per-thread guest-run cap (e.g. max N guest-triggered runs per hour, one in flight at a time) so a drive-by can't drain the budget.
  2. Auto-run on every guest post when that toggle is on (no checkbox for guests — they just reply and Claude answers), same caps.

Or leave it member-gated as it is, in which case PR #57 is ready to merge as-is.

oseboasked Osebot50d ago

There’s no ask Claude check for anon repliers

Osebotfable-5-150d ago

Taking this as "add it": guests on a public + anyone-can-reply thread get an Ask Claude checkbox too (no extra owner toggle — turning on "anyone can reply" is the opt-in).

Guard rails, since a run spends the workspace owner's GitHub token + ~45 min of sandbox:

  • server accepts guest askClaude only when the thread is public + anyone-can-reply and has a workspace;
  • per thread: at most one guest-triggered run in flight and ≤3 guest-triggered runs per hour → 429 with a readable message shown under the composer;
  • guests still get no model picker, no attachments, no fork/new-thread.

Touches app/api/threads/[id]/posts/route.ts, lib/data.ts (addHumanPost + a guestRunBudget check), lib/session.ts comments, components/composer.tsx. Will push to the same branch and open a follow-up PR.

Osebotfable-5-150d agothreadide@c8215cd

Added — PR #58 on thread/b5d355e8, commit c8215cd (follows #57, which has merged).

What changed

On a public thread marked anyone can reply, a visitor without an account now sees the Ask Claude checkbox in the guest composer (button reads "Post as guest & run"). No extra toggle: switching on "anyone can reply" is the opt-in. Guests still get no model picker, no image attachments, and can't fork or start threads; the per-post Ask Claude / Fork buttons stay members-only because those routes need a session.

Guard rails (a run spends your GitHub token + up to ~45 min of sandbox)

guestRunBudget() in lib/data.ts, checked in the posts route and re-checked in addHumanPost:

  • at most one guest-triggered run in flight per thread;
  • at most 3 guest-triggered runs per rolling hour per thread (GUEST_RUNS_PER_HOUR in lib/guest.ts);
  • otherwise the API answers 429 with a plain-English reason, which the composer shows under the form (the reply isn't saved, so the guest can untick Ask Claude and post anyway).
    "Guest-triggered" = jobs whose trigger post has meta.guest, so member runs don't eat the guest budget and vice versa. Threads without a workspace still can't run Claude for anyone.

Files

app/api/threads/[id]/posts/route.ts (guest askClaude path), lib/data.ts (guestRunBudget, addHumanPost check), lib/guest.ts (constant), app/threads/[id]/page.tsx (canAskClaude includes guests, new canRunPosts for PostView), components/composer.tsx, lib/session.ts (comments only).

Verified with tsc; no DB in the sandbox so the SQL for the budget query (count with filter (where …) over jobs ⋈ posts) is untested live — it's standard Postgres but worth one guest run after deploy. If 3/hour turns out too tight or too loose it's a single constant.