Repository navigation
feat(settings): operator-intake Settings home (ent#463) - #2418
Conversation
Adds a durable admin-only opt-in surface for the operator-intake (identified contact record: email + optional company/name/role/use_case, POST to the hosted intake endpoint at `intake.abilityai.dev/v1/operator-intake`) beside the existing telemetry-sharing panel. Necessary because #2385 (v0.9.5 cut) stops rendering the first-run welcome form on any install that has a pre-provisioned admin — i.e. every prod install, every start.sh install, every hosted droplet, every ADMIN_PASSWORD-provisioned dev install. Without a Settings home the intake opt-in becomes silently unreachable for the majority of installs. Both surfaces converge on `submit_operator_intake` — no second intake client, no forked payload — and the at-most-once marker is preserved across both producers, so a Settings-driven opt-in on an install where the welcome form also submitted is a no-op. Design decisions (ent#463 AC #4/#5): * Resubmit = no-op. Second submit does not re-fire; at-most-once semantics are the intake's designed contract, and a duplicate lead is worse than a missed one. The panel shows terminal "already submitted" state with the timestamp when known, "date unknown" otherwise (for pre-ent#463 markers). * Opt-out = durable decline, does NOT roll back the marker. The record has already been sent; the panel is honest that record deletion needs a support request to the hosted endpoint. * OPERATOR_INTAKE_ENABLED / DO_NOT_TRACK continue to win over the Settings control (409 on a fresh-install submit attempt while hard-disabled). Auth is admin AND human-only (reject_agent_principal), matching the telemetry-sharing gate; a distinct `operator_intake_consent` audit action distinguishes Settings-driven consent from first-run consent in the audit log. The generic PUT /api/settings/{key} catch-all refuses `operator_intake_*` keys with 422+pointer, mirroring the telemetry_sharing_* guard shape (trinity-ops-agent#232 class: an admin-owned agent key must not be able to write consent through the unvalidated route). Files: * Service: added is_consent_enabled/is_hard_disabled/is_already_submitted/ get_status/set_consent/submit_from_settings. submit_operator_intake now also stamps `operator_intake_submitted_at` so the panel can render honest state on new submissions. * Router: GET/PUT /api/settings/operator-intake (both registered before /{key} — Invariant #4); catch-all guard added. * Model: OperatorIntakeUpdate. * Frontend: OperatorIntakePanel.vue (three states: fresh form / terminal already-submitted / hard-disabled banner) + operatorIntake store, mounted on the General tab beside TelemetrySharingPanel. * Tests: tests/unit/test_ent463_operator_intake_settings.py — 14 cases covering state axes, at-most-once, opt-out no-rollback, hard-disabled 409, agent-principal rejection, audit no-PII, catch-all guard. * Docs: architecture.md § operator_intake_service.py updated. Fixes ent#463 (abilityai/trinity-enterprise). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
dolho
left a comment
There was a problem hiding this comment.
/review Report — PR #2418
Branch: feature/ent463-operator-intake-settings → dev (merge-base d3405c8e)
Files: 8 (+960/-10) · Scope: CLEAN · Plan completion: 8 AC — 7 done, 1 partial (AC #2)
Good PR. The convergence decision is right, the state model is genuinely three-axis rather than a boolean pretending, and the design decisions are argued in code rather than only in the description. One finding on the state the panel cannot tell the truth about — which is the one AC #2 promises.
Informational
[I1] The Settings surface reports success for a submission that did not land — and the marker makes it terminal (Confidence: 9/10)
services/operator_intake_service.py — the marker is written before the POST and deliberately never rolled back:
db.set_setting(_INTAKE_SUBMITTED_KEY, "true")
db.set_setting(KEY_SUBMITTED_AT, submitted_at)
...
resp = await client.post(OPERATOR_INTAKE_URL, json=payload)
# The marker is NOT rolled back (re-send risks a duplicate lead ...)and submit_from_settings returns success unconditionally after awaiting it:
await submit_operator_intake(...)
return SettingsIntakeResult.SUBMITTEDsubmit_operator_intake never raises and returns nothing, so a 500 from the hosted endpoint, a redirect, a DNS failure or a read timeout all reach the caller as SUBMITTED. The router then refreshes status, the panel switches to its terminal "already submitted on {date}" state, and the marker forecloses any retry.
So an operator who opts in while the intake endpoint is down gets: a panel confidently asserting the record was submitted, a durable marker preventing a second attempt, and no record at Ability.ai — recoverable only by hand-editing system_settings. The sole trace is a WARNING in the backend log.
This is not a criticism of the at-most-once design, which is right, and the pre-#1593 behaviour is fine for what it was: a background, best-effort POST at first-run, where nobody is watching and nothing claims otherwise. What changes here is the context — an interactive control a human just clicked, whose stated job (AC #2) is to show honest state. "Submitted on 2026-08-27" when the POST 500'd is the one state it renders dishonestly, and it is also the one that cannot be corrected afterwards.
The repo already has the shape for this: #1018's success_unsettled on the x402 path, which returns 200 with the response but refuses to call an unsettled payment "success". Same medicine here — have submit_operator_intake report whether it landed, and add a SUBMITTED_UNCONFIRMED result the panel renders as "recorded — delivery not confirmed; see logs". The audit submit_outcome then also stops recording SUBMITTED for a failed send.
Minimum version if you would rather not touch the plumbing: change the panel's wording so it asserts consent recorded, not delivery. What must not stay is a terminal, unrecoverable UI claiming an external write happened when the code cannot know that.
[I2] get_status() degrades inconsistently — three fields defensive, two not (Confidence: 8/10)
"submitted_at": db.get_setting_value(KEY_SUBMITTED_AT, None),
"consent_at": db.get_setting_value(KEY_CONSENT_AT, None),is_consent_enabled() and is_already_submitted() each wrap their read in try/except → safe default, with a comment saying a read failure must degrade. These two do not, so a settings-read failure raises out of get_status() and the GET route 500s — the whole panel disappears rather than rendering the three axes it could still answer. Either wrap them the same way, or drop the try/except from the siblings so the degradation policy is one decision rather than three.
[I3] No test drives the failed-submission path (Confidence: 8/10)
The 14 tests cover the state axes, at-most-once, opt-out no-rollback, the hard-disabled 409, agent-principal rejection and the catch-all guard — but nothing exercises a non-2xx or a raising POST. That is precisely the path I1 is about, and it is why a green suite is compatible with the panel lying. One test asserting the outcome when client.post returns 500 (and another when it raises) would pin whichever resolution you choose for I1.
Verified clean
- Auth (4.3). Both routes are
assert_admin, which since #1890 rejects agent and connector principals itself — I read the body to confirm rather than trusting the name. The explicitreject_agent_principalon the PUT is belt-and-braces, consistent with how the repo describes that pairing. No path-param/dependency mismatch (these are keyless routes). - Invariant #4.
/operator-intakeis registered at lines 330/344, well above/{key}at 2861. - Catch-all guard.
key.startswith("operator_intake_")→ 422 inPUT /{key}, and it deliberately covers the pre-ent#463operator_intake_submittedkey too — the ent#12 mirror, done properly. - Credential exposure (4.4). The email and profile fields never reach the audit
details(onlyhas_email), and the service logs the install-id prefix rather than the address. Checked both. - Hard-disable precedence.
submit_intentis computed before the 409 so a pure consent flip (no email, or an opt-out) still records durable state while a submit attempt is refused — that distinction is subtle and correct. - Frontend. Store surfaces
e.response.data.detail, so the 409's message reaches the operator rather than a generic failure. Nov-html. - Tests. 38 pass across this suite plus
test_operator_intakeandtest_ent12_telemetry_sharing.
Summary
- Critical: 0
- Informational: 3 — I1 is the one I would take before merge
- Scope: clean — 8 files, all of them the surface described; nothing incidental
Not blocking on I1: the consent record itself is correct, the at-most-once semantics it inherits are pre-existing and deliberate, and the fix is additive. But I would not leave a terminal, unrecoverable panel asserting an external write the code cannot confirm — and the wording change alone is a one-line version of the fix.
Worth a learnings.md entry alongside whichever fix you pick, because the class is durable and not obvious: a fire-and-forget background contract reused by an interactive surface inherits its silent-failure semantics, and "nobody is watching" stops being true at exactly that moment.
Approving.
Summary
Adds a durable admin-only Settings surface for the operator-intake opt-in
(identified contact record — email + optional company/name/role/use_case),
beside the existing telemetry-sharing panel.
Why now. #2385 (merged to dev, awaiting v0.9.5 cut) refuses the first-run
welcome form on any install with a pre-provisioned admin. Without this
Settings home, the intake opt-in silently disappears for the majority of
installs post-v0.9.5. Fixes ent#463.
Both surfaces converge on
submit_operator_intake— no second intake client,no forked payload — and the at-most-once marker is preserved across both
producers.
Design decisions (recorded in ent#463 comment; codified in code)
a duplicate lead is worse than a missed one. Panel shows terminal
"already submitted" state with the timestamp when known, "date unknown"
otherwise (for pre-ent#463 markers).
record has already been sent; the panel is honest that record deletion
requires a support request to the hosted endpoint (no local delete
authority).
OPERATOR_INTAKE_ENABLED/DO_NOT_TRACKwin over the Settings control(AC Feature/process engine #6). A fresh-install submit attempt while hard-disabled returns 409;
pure consent flips (no email, or opt-out) still record durable state.
reject_agent_principal), matching thetelemetry-sharing gate (AC security: Fix token logging and add HTML reports to gitignore #7). An admin-owned agent-scoped key must not
be able to write consent (trinity-ops-agent#232 class).
operator_intake_consent(AC security: implement safe tar extraction with symlink/hardlink validation #8) so aSettings-driven consent is distinguishable from a first-run one in the
audit log. Email + profile values never logged.
Changes
src/backend/services/operator_intake_service.py):added
is_consent_enabled,is_hard_disabled,is_already_submitted,get_status,set_consent,submit_from_settings.submit_operator_intakenow also stamps
operator_intake_submitted_atso the panel can renderhonest state on new submissions (legacy markers report NULL and the UI
shows "date unknown").
src/backend/routers/settings.py):GET/PUT /api/settings/operator-intake(registered before
/{key}— Invariant fix: add missing logging_config.py to backend Dockerfile #4). Generic catch-all guard addedfor the
operator_intake_*key family (mirror of the ent#12telemetry_sharing_*guard).src/backend/models.py):OperatorIntakeUpdate.OperatorIntakePanel.vue— three states (fresh form /terminal already-submitted / hard-disabled banner) +
operatorIntakePinia store, mounted on the General tab beside
TelemetrySharingPanel.tests/unit/test_ent463_operator_intake_settings.py— 14 unittests, all pass locally. Covers state axes, at-most-once, opt-out
no-rollback, hard-disabled 409, agent-principal rejection, audit no-PII,
catch-all guard for all four
operator_intake_*keys.docs/memory/architecture.md§operator_intake_service.pyupdated with the Settings-home addition.
Acceptance criteria coverage (from ent#463)
operator_intake_servicepath (submit_from_settingsdelegates to
submit_operator_intake)(no local delete authority)
DO_NOT_TRACK/OPERATOR_INTAKE_ENABLEDwin over Settings (409)reject_agent_principaloperator_intake_consentaction, no PII in details)Test plan
pytest tests/unit/test_ent463_operator_intake_settings.py— 14 passtest_operator_intake.py(14 pass),test_ent12_telemetry_sharing.py(10 pass),test_setup_operator_profile.py(24 pass),
test_1987_instance_label.py(28 pass)GET /api/settings/operator-intakeas admin→ fresh install returns unsubmitted state; submit form; refresh →
terminal state with timestamp; toggle off → durable decline;
OPERATOR_INTAKE_ENABLED=falserestart → hard-disabled bannerPUT→ 403PUT /api/settings/operator_intake_consent_enabled→ 422 with pointer to
/api/settings/operator-intakeFixes Abilityai/trinity-enterprise#463
Generated with Claude Code