Repository navigation
Setup: the owner accepts the engine license, and the box is linked to them (#465, O1) - #488
Draft
teaspoonai wants to merge 34 commits into
Draft
teaspoonai wants to merge 34 commits into
teaspoonai wants to merge 34 commits into
Conversation
) The box's owner accepts the license at setup, and their acceptance is linked to the box's appliance key. license.json holds no secret and the box's agent can read it, so the link needs proof that the box asks: a per-box secret the Worker mints with the key's first issue (and again on a move to a newer maker record), answered once as link_secret beside the document and kept only as its SHA-256 (migration 0005, additive). A repeat request for the same record gets no secret: its maker id is in the box's receipt, which the agent can read. POST /api/license/link {acceptance_id, license_id, device, link_secret} sets licenses.acceptance_id for an unrevoked, unreleased appliance key on that device whose secret matches (constant time, checked before anything about the acceptance is told), for an acceptance on record, not revoked and of the current license. The same acceptance again is a no-op; another moves it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…465) license_accept.py records the owner's acceptance with method tty (the CHECK of acceptances.method takes tty or flag only), installer setup:git:<rev>, the appliance serial's hash as device_id, and licensed use under the box's appliance key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#465) license_accept.py (root, behind sudo) takes the owner's email and the SHA-256 of the text the page showed, never an acceptance id. It makes POST /api/accept itself and records the returned id in install.sh's own receipt, /var/lib/teaport/eula-accepted.json ("method": "setup"), so later runs get tokens from it. Offline it queues the email in a root-owned /var/lib/teaport/eula-queued.json and sends it once online. It works only while provisioning's marker /var/lib/teaport-owner/license-pending is there, and once: a recorded or queued acceptance is never replaced. Device id: the appliance serial's hash on a factory box, the machine id's elsewhere. license_link.py (root) takes nothing: it reads the record, license.json and /etc/teaport/license-link.secret (root 0600) and calls POST /api/license/link. For the run user only while setup is unfinished: the Settings session cannot be verified (its key is in brain.env, which the run user reads); root and an administrator through sudo may always. A link removes the marker; a re-link of the same acceptance sends nothing; no secret file: logged, nothing done. teaport-license-owner.timer (enabled by the package) runs both as root after boot and every 15 minutes, only while a queue or the marker is there. sudoers-sync writes a line for each helper (NOLOG_INPUT for the email). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…les (#474 F1) config_apply, wifi_apply, login_apply and update_apply (and the two license helpers) carry the same PROTECTED tuple: /etc/teaport/license.json, license-revocations.json and license-link.secret. Every write, rename or removal they make refuses one of them, by name or through a link, even if their own allowlist came to name it. A test per helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The setup page (every first-boot path: spoken, the audio kit's room mic, headless #457 start the same teaport-wifi-setup unit) shows the whole license text, the owner's email and a box to tick while setup is unfinished. Required: the join waits for it, as setup finishes only once it is accepted; offline the acceptance is queued and the join goes on. With no copy of the text on the box and no internet, the page says it comes in Settings. Settings has the same card (GET/POST /api/eula), above the login's. Only setup waits: the engine runs under the box's appliance key. Words in all 13 catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…setup (#465) The factory branch of eula_gate accepts nothing, but keeps the manifest's license text, checked against its SHA-256, as $STATE/EULA-v<version>.txt: the setup page has no internet to fetch it. Best effort. A setup receipt ("method": "setup") gets tokens like an installer's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The setup guide's Accept the license, the Settings card, the licenses page, the root helpers and their timer (installer, security model), and docs/engine-license-data.md: the setup acceptance's row, the link and link_secret_hash, the box's files. RELEASING.md: what the seal and install.sh (I1) must write. Citations moved by the code re-checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nlinks (#465) Review fixes. Every failure before the link secret is proven (a key not on record, another tier, another device, no secret, a wrong one) is the same 403 bad_link_secret: no oracle for the key's records. applianceMove also empties acceptance_id, so a box provisioned again is no longer linked to its previous owner; the next owner links at their setup. The setup test now sends worker/test/fixtures/setup-accept.json, the exact body license_accept.py's send() builds (a brain test holds send() to it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…refused links (#465) Review fixes. - Origin: both helpers send only to the built-in https://get.teaspoon.tech/api (install.sh's own). A manifest naming another server, or a text off the origin, is no license; a record or queue naming one gets nothing sent, the link secret least of all. - One send at a time: an flock in /var/lib/teaport around accept, the timer's flush and the link, so accept and flush at once POST once. - A link the server says no longer applies (409 eula_changed, 404 unknown_acceptance) clears the setup's record and keeps the marker: the setup step is offered again. 409 conflict is retried, not remembered. No secret yet: record and marker kept, no refusal remembered; it links once the secret is there. - The window before the link: status gives the recorded email masked (o***@e***.com) and whether accept with replace may still replace it, only while the marker is there and nothing is linked. - Personal use and no license_id: /api/accept cannot check a license_id, so the key is tied to its owner by the authenticated link alone. - Tests: the origin pin, concurrent sends, every refused-link path, a whole setup that leaves the key and the secret as they were (behavioral, in place of a source grep). wifi_apply._lock: its docstring first again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se (#465) Review fixes. The setup page and the Settings card show an acceptance already on the box with its email masked, and, until it is linked, take another in its place. Creating the login from Settings is refused while the license step is pending, as on the setup page. Tests: the spoken path through WifiSetupVoice._start, and that nothing in Settings but the login asks for the license (both behavioral, in place of source greps). Words in all 13 catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…future work (#465) security.md: both helpers talk only to the built-in server; the window an agent could accept first in, shown masked and replaceable until the link, and open for as long as nothing links (before I1). engine-license-data.md: the setup acceptance is personal with no license_id, licenses.acceptance_id is the only record of an owner, a move unlinks. wifi-setup.md: the link needs the key file and its secret; Not you?. configuration.md: the login waits for the license. RELEASING.md: the seal's and install.sh's parts are F1's and I1's, not built yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ready made answers first (#465) The owner's decision: setup asks whether the box is for personal use or for a business. Migration 0006 adds acceptances.owner_use, additive: 0001's CHECK on use_type takes personal or licensed only (widening it needs a table rebuild) and licensed needs a Teaspoon AI license id a box's owner has none of. /api/accept takes owner_use only with use personal, no license_id and a setup installer (setup:...); it licenses nothing and leaves the 3-device cap alone (which counts personal keys). The fixture is regenerated with owner_use. Review: in link(), a key already linked to this acceptance answers 200 changed:false before the acceptance's own checks, so a link whose answer was lost, asked again after the license changed, is not told 409 (on which the box would drop the owner's record). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es apart; personal or business (#465) Review fixes and the owner's decisions. - Replace (Not you?) works for the run user only while the owner's login is still to make (login_apply's pending marker): the window is the login's. After it, an administrator (sudo with their password: SUDO_UID not the run user's) can, until the link; nobody after the link. - The mask shows the whole domain and the first and last character of the part before it, one * for each in between (o***r@example.com): a lookalike (o*@ex.com) no longer matches; a 1-character part is all *. - The setup step asks personal use or a business; the helper requires owner_use and sends it with use personal and no license_id. - The lock waits at most LOCK_SECS (30 s, under the page's helper limit), then refuses as busy (try again); the link helper answers busy. - Words in all 13 catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…465) The owner's decision: a wrong link is fixed by support by hand. security.md and the setup guide say what the owner sees and what support does, with the statement Teaspoon AI staff run; RELEASING.md has the procedure (check the key, find the acceptance by email and serial hash, link; or unlink and send the box through setup again). engine-license-data.md: acceptances.owner_use and why it is a column of its own. The window before the link is the login's now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…0006's columns only when set (#465) Round-3 review. - POST /api/accept takes an optional request_id (22-64 base64url), the sender's own; migration 0006 (unpushed) adds acceptances.request_id with a unique partial index. The same request sent again (its answer lost) records no second row and answers the first acceptance's id; the same id with another email, license or owner_use is 409 request_id_reused. - An email with a Unicode control or format character (a zero-width space, a right-to-left override) is refused. - owner_use and request_id are written only when set, so an installer's acceptance still works against a schema without 0006 (tested). - The fixture carries the box's request_id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t outlasts the lock, request_id (#465) Round-3 review. - The helper refuses an email with any Cc or Cf character; owner_license checks the same before any sudo. - The mask shows the domain in its ASCII (IDNA) form, so a lookalike letter from another script shows as xn--. Its docstring says what it cannot tell apart: a hint, not a proof; support is the remedy. - owner_license.HELPER_SECS covers the lock wait plus the manifest, the text and the POST, so the page never kills the helper mid-POST. - Each queued acceptance carries a random request_id, sent with every try of it (a new one for an acceptance in its place). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry records or the secret's hash (#465) Round-3 review. RELEASING.md and security.md: a license_id alone is never proof. Proof A, the key's maker acceptance (or its first) is that serial's; proof B, for a box whose maker records are gone, the owner runs a command (sudo, their password) that prints the SHA-256 of the box's link secret, compared with link_secret_hash. The manual link checks the acceptance is of the current license in the statement itself; the unlink names tier appliance and the same proof. The mask is a hint, not a proof. engine-license-data.md: acceptances.request_id (kept on top of f7c7a41's erasure text). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 254 UTF-8 bytes for an email (#465) Round-4 review. - A previous owner who had root on the box can have copied its secret, so every link rotates it: the answer carries a new link_secret and the presented one stays valid as link_secret_prev_hash (migration 0005, additive, unpushed) until the box shows the new one. The box shows it at once (a confirm: the same link with the new secret, answered with no new secret, which drops the previous). A box that failed to write the new one presents the old one again and gets another, so it is never locked out. After a new owner's setup links, a copied older secret links nothing. A move clears a pending handover. - /api/accept refuses an email that NFKC would change (a fullwidth letter, a Kelvin sign, a Roman numeral) and counts its length in UTF-8 bytes (at most 254), as the box does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f the box re-links; NFKC (#465) Round-4 review. - license_link.py writes the new secret a link answers with (root 0600, atomically: the one write of a protected file, and only of the license server's answer), then confirms with it; only then is the link recorded and the marker gone. A failed write keeps the old one, which still links; a lost confirm is sent again with the new one. - An administrator (sudo with their password) or root may accept, replace and link at any time, after the link too: support's re-link from the box, proven by the box's secret through the endpoint. Online only after setup. The run user's rules are unchanged. - valid_email refuses what NFKC would change and counts UTF-8 bytes (<= 254), as the Worker; ZWNJ/ZWJ domains are refused, a documented trade-off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…book that never pastes values into commands (#465) Round-4 review. security.md and RELEASING.md: the primary re-link is the owner, holding the box, accepting and linking it with sudo (the box's secret is the proof, rotated by every link); the SQL path (proof A, the factory's records) only when the box cannot reach the license server. Every requester value is read at a prompt, checked against a strict pattern (anything else by hand), and put into a statement file by printf arguments, run with --file. engine-license-data.md: the rotation and link_secret_prev_hash. The ZWNJ/ZWJ trade-off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…link runbook, tested (#465) Round-5 review. Rotation means whoever links first wins, and a copy of the secret (someone who had root on the box) can lock the real box out; nothing can tell the two apart. Support verifies the owner and sets a recovery code as the key's secret, with link_recovery_expires (migration 0005, additive, unpushed): it links once, before it runs out (403 recovery_expired after), and the rotation that follows gives the box a fresh secret; the copy then links nothing. A move empties it. worker/test/relink-runbook.test.mjs runs RELEASING.md's re-link functions as written (bash, stubbed wrangler and curl): hostile values (a quote, a SQL comment, a command substitution, in each field) build and run nothing; plain ones build statements that, on the fake D1, find the serial's key, set a code that gives a locked-out box its link back, and link only an acceptance of the current license. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he receipt (#465) Round-5 review. - A 403 bad_link_secret for a secret that linked before (license-link.json remembers it worked) is LOST: said in status, on the setup page, the Settings card and teaport status, logged, not remembered as a refusal. - license_link.py link --recovery-code: an administrator's or root's only; the code is typed at a prompt (getpass), never an argument, presented as the secret; the rotation writes a fresh one. - No link while an acceptance waits in the queue (never the one it replaces). - accept() never removes the record before a new one is recorded: a replace that waits, fails (503, 429, no answer) or is dropped leaves the receipt. A queued acceptance shows over the record it replaces. - Words in all 13 catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ok whose checks stop (#465) Round-5 review. security.md and RELEASING.md: a copy links nothing after the real box's next link, not after any link; before it, whoever links first wins, the box shows a lost link, and support decides who the owner is and gives them a recovery code, typed on the box. A helper killed mid-handover keeps only the box's own previous secret alive. The runbook is bash functions whose every check ends the step, with no free-form text in SQL (an email only when plainly ASCII with no quote, else by hand and by id). cli.md: teaport status's license line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is not kept; unreadable ends are past (#465) Round-6 review. - link_secret_prev_expires (migration 0005, additive, unpushed): a link keeps the presented secret as the previous for PREV_SECS (1 hour), and a handover is pending while it is set; after it the previous secret is refused, so a confirm that never comes keeps no older secret, a copy's included, alive for ever. A recovery link keeps no previous at all: the code links once, and a lost confirm leaves it dead (the box confirms with its new secret, or support sets another code). - Any recovery or previous end that is not a time ('' included) counts as past. - The re-link runbook test: every write must report exactly one row changed (the stub answers 0, 1, 2 as wrangler --json does), the code is shown only then, every step reads the box's values fresh, and the recovery end is the database's own strftime, read by the Worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… too (#465) Round-6 review. license_link.py writes /var/lib/teaport/license-handover (root's, 0600, ids only) before a link, and removes it once the handover is confirmed or refused for good; teaport-license-owner.service now also runs while it is there, so a confirm lost after setup (an administrator's re-link, a recovery code) is sent again before the license server lets the previous secret go. Tests: a lost confirm after setup completed by the timer, a recovery code unusable after a lost confirm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd; runbook writes that check their row count (#465) engine-license-data.md (and RELEASING.md, security.md): a Teaport appliance comes with a Commercial License (EULA v2 §3.2), its appliance key; the owner's acceptance is personal with no license_id, plus owner_use; ownership is recorded only by the authenticated link. link_secret_prev_expires, the handover marker on the box, and the recovery code's end by the database's clock. RELEASING.md's runbook: relink_changed stops unless exactly one row changed; every step reads the box's values again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PREV_SECS is 24 h: a box unplugged mid-handover and plugged in the next day still confirms. A recovery link now keeps the code as the previous secret like any other, so a lost answer can be asked again with it; the code dies at the confirm or at link_secret_prev_expires, whichever comes first. Tests: the boundary on both sides, the code's retry, its death after the confirm and after the end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the link A first link whose secret is refused while a handover of the box's own never settled (its answer lost, its day gone) is recorded as lost, why handover_lost, not as an ordinary refusal: status, the setup page, the Settings card and teaport status say so, with whom to ask (new msgid in the 12 catalogs). The already-linked shortcut removes license-handover too, so a crash after the confirm cannot keep the timer running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wrangler 4.166 runs a --remote --file through D1's import API, whose answer is a summary, not the rows a statement changed, so the runbook no longer reads meta.changes: a SELECT through the query API (--command) must find exactly the one row before each write, and one after it must find that row holding what was written, before a recovery code is shown. The test's wrangler stub answers in both real shapes, on a SQLite file the Worker under test reads, including a write that does not land. Docs: a day, not an hour; the recovery code retried until the confirm; the lost-handover message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… cause A box that never linked cannot tell why its secret is refused after a try that got no answer: a handover answer lost, a key with no secret hash, a secret the factory wrote wrong (an answer it got would have linked, and made the refusal a plain lost link). It records why cause_unknown, not handover_lost, and says it in neutral words: "This Teaport's license link failed. Contact Teaspoon AI support." (the 12 catalogs), "FAILED" in teaport status. Test: the lost-answer and the timeout-then-refusal paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A box whose very first link gets 403 bad_link_secret holds a secret that does not match: a factory write error, a key issued before 0005, a copy's holder who linked first. Only support fixes any of them, so "unlinked" told the owner nothing: it is recorded as lost, why cause_unknown, like a later refusal of a secret that never linked, and said as a failed link. Only bad_link_secret: eula_changed, unknown_acceptance, conflict and the other refusals keep their own handling. The earlier round's test that wanted "unlinked" now wants the failed link, and checks the others do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A box that never linked says only that its link failed. Support reads the key's row first: no secret hash (issued before link secrets, or the first issue's answer lost: provision again), another device (released, provision again), or both right (the lost-link case). relink_key now shows whether the key has a secret hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying teaport-docs with
|
| Latest commit: |
2c66fc5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://67e2faf3.teaport-docs.pages.dev |
| Branch Preview URL: | https://feat-owner-accept-465.teaport-docs.pages.dev |
…ash (#465) The acceptances table gave only the machine-id case; a setup acceptance sends the appliance serial's hash, as the setup section already says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ccept-465 Conflicts were citation lines only: O1's side kept, sources fixed. The citations whose install.sh lines really changed (#480's --install-agent, user_manager and the voice-only hint) now cite main's ranges, moved to the merged install.sh, whose claims are #480's own and still hold: installation.md (the agent option, the voice-only hint), troubleshooting (linger), updating (the channel), installer.md (the parser, the options table, the overrides table). No #480 wording dropped: each page's prose matches origin/main's apart from O1's own sections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
teaspoonai
added a commit
that referenced
this pull request
Nov 30, 2026
…nto the installer license branch install.sh keeps both sides: I1's license-key paragraph, TEAPORT_LICENSE_FILE / TEAPORT_LICENSE_MODE and their checks beside #480's agent paragraph, TEAPORT_INSTALL_AGENT / --install-agent and its checks (--install-agent is refused with any --only, --only license included). ci.yml keeps #475's signed-manifest dry run and composite-action layout, with #480's --install-agent dry-run step reading the checkout's manifest the same way, and one more refusal checked: --only license --install-agent. Docs: the flags paragraph names both sides' usage errors; elsewhere I1's text with both sides' citations to be moved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
teaspoonai
added a commit
that referenced
this pull request
Nov 30, 2026
… the merged install.sh The six that moved past --fix-sources: the voice-only note and the linger cause (#480's lines, which say --install-agent now), the parser, the flags and the env tables (which gained --install-agent and TEAPORT_INSTALL_AGENT), and the channel paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #465 when merged. Part of #474 (step O1). Stacked on #481 (W1, draft); its base is that PR's branch.
Draft, no deploy. The Worker part deploys with #481, through
worker-deploy, with the owner's OK. The box part ships in a teaport release.What it does
The owner accepts the Teaport Engine License at setup, and the box's appliance key is linked to them.
Setup
acceptances.owner_usein migration 0006. That needs no license id, and it doesn't change the 3-device cap.The root helpers (sudoers lines included)
POST /api/acceptitself, with arequest_idthat dedups resends, and records the answer root-only under/var/lib/teaport. Offline, it queues and sends later through a timer.Worker
POST /api/license/linkneeds the secret. Every failure before the secret is proven gets the same 403. A link that is already in place answers before the license is checked.Contests and support
A previous owner who copied the secret while they had root can link first after a private sale; no design can tell the real box from such a copy.
worker/test/relink-runbook.test.mjsruns the runbook exactly as written.Other changes
update_apply.pyincluded, refuses to write, rename or removelicense.json,license-revocations.jsonorlicense-link.secret(F1, teaport side).Decisions (owner, 2026-11-28/29)
personal, no license id; ownership is proven only by the authenticated link).Not here
license.jsonandlicense-link.secretat the factory, and must never rewrite the secret on renewal.Tests
An independent review agent took 9 passes, and the last was clear. Along the way it found and the branch fixed:
🤖 Generated with Claude Code