@integrity-labs/agt-cli 0.28.1264 → 0.28.1265

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/{api-client-Q2FXLBH5.js → api-client-LPV5RUCO.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-GZMUGH6X.js → chunk-6ENTMJ5T.js} +3 -3
  4. package/dist/{chunk-5BXIXSSH.js → chunk-BMO6GCK2.js} +2 -2
  5. package/dist/{chunk-GSMGU2QA.js → chunk-DRP3J4CV.js} +5 -5
  6. package/dist/{chunk-KJ5OCCSJ.js → chunk-W2GHPRPZ.js} +2 -2
  7. package/dist/{chunk-KJ5OCCSJ.js.map → chunk-W2GHPRPZ.js.map} +1 -1
  8. package/dist/{chunk-HJWOXFJM.js → chunk-X2FBQPNR.js} +2 -2
  9. package/dist/{chunk-C3PSUSJ2.js → chunk-ZIAXGM6I.js} +3 -3
  10. package/dist/{claude-code-updater-JQLNRK25.js → claude-code-updater-XISTQTZX.js} +3 -3
  11. package/dist/{claude-pair-runtime-M6VJ3KZ3.js → claude-pair-runtime-2EOLNZEY.js} +3 -3
  12. package/dist/lib/manager-worker.js +21 -21
  13. package/dist/mcp/direct-chat-channel.js +1 -1
  14. package/dist/mcp/index.js +1 -1
  15. package/dist/mcp/origami.js +1 -1
  16. package/dist/mcp/slack-channel.js +1 -1
  17. package/dist/mcp/telegram-channel.js +1 -1
  18. package/dist/mcp/xero.js +727 -169
  19. package/dist/{persistent-session-3OES5QXZ.js → persistent-session-C7UKT4EE.js} +4 -4
  20. package/dist/{responsiveness-probe-BSSNRCPM.js → responsiveness-probe-NV3LXAWL.js} +4 -4
  21. package/dist/{session-auth-dead-A3TO2N63.js → session-auth-dead-U62KZ342.js} +3 -3
  22. package/package.json +1 -1
  23. /package/dist/{api-client-Q2FXLBH5.js.map → api-client-LPV5RUCO.js.map} +0 -0
  24. /package/dist/{chunk-GZMUGH6X.js.map → chunk-6ENTMJ5T.js.map} +0 -0
  25. /package/dist/{chunk-5BXIXSSH.js.map → chunk-BMO6GCK2.js.map} +0 -0
  26. /package/dist/{chunk-GSMGU2QA.js.map → chunk-DRP3J4CV.js.map} +0 -0
  27. /package/dist/{chunk-HJWOXFJM.js.map → chunk-X2FBQPNR.js.map} +0 -0
  28. /package/dist/{chunk-C3PSUSJ2.js.map → chunk-ZIAXGM6I.js.map} +0 -0
  29. /package/dist/{claude-code-updater-JQLNRK25.js.map → claude-code-updater-XISTQTZX.js.map} +0 -0
  30. /package/dist/{claude-pair-runtime-M6VJ3KZ3.js.map → claude-pair-runtime-2EOLNZEY.js.map} +0 -0
  31. /package/dist/{persistent-session-3OES5QXZ.js.map → persistent-session-C7UKT4EE.js.map} +0 -0
  32. /package/dist/{responsiveness-probe-BSSNRCPM.js.map → responsiveness-probe-NV3LXAWL.js.map} +0 -0
  33. /package/dist/{session-auth-dead-A3TO2N63.js.map → session-auth-dead-U62KZ342.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  encodeClaudeProjectPath
3
- } from "./chunk-KJ5OCCSJ.js";
3
+ } from "./chunk-W2GHPRPZ.js";
4
4
 
5
5
  // src/lib/daily-session.ts
6
6
  import { randomUUID } from "crypto";
@@ -244,4 +244,4 @@ export {
244
244
  peekPreviousSession,
245
245
  readDailySessionPin
246
246
  };
247
- //# sourceMappingURL=chunk-HJWOXFJM.js.map
247
+ //# sourceMappingURL=chunk-X2FBQPNR.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HOST_ROTATE_KEY_CONFLICT
3
- } from "./chunk-KJ5OCCSJ.js";
3
+ } from "./chunk-W2GHPRPZ.js";
4
4
 
5
5
  // src/lib/config.ts
6
6
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
@@ -103,7 +103,7 @@ function exchangeFailureKind(err) {
103
103
  }
104
104
 
105
105
  // src/lib/api-client.ts
106
- var agtCliVersion = true ? "0.28.1264" : "dev";
106
+ var agtCliVersion = true ? "0.28.1265" : "dev";
107
107
  var lastConfigHash = null;
108
108
  function setConfigHash(hash) {
109
109
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -468,4 +468,4 @@ export {
468
468
  api,
469
469
  getHostId
470
470
  };
471
- //# sourceMappingURL=chunk-C3PSUSJ2.js.map
471
+ //# sourceMappingURL=chunk-ZIAXGM6I.js.map
@@ -13,9 +13,9 @@ import {
13
13
  probeClaudeInstalls,
14
14
  readsAsNativeInstall,
15
15
  shouldRunClaudeCodeUpdater
16
- } from "./chunk-5BXIXSSH.js";
16
+ } from "./chunk-BMO6GCK2.js";
17
17
  import "./chunk-XWVM4KPK.js";
18
- import "./chunk-KJ5OCCSJ.js";
18
+ import "./chunk-W2GHPRPZ.js";
19
19
  import "./chunk-AIUIMEUS.js";
20
20
  import "./chunk-DGUM43GV.js";
21
21
  export {
@@ -34,4 +34,4 @@ export {
34
34
  readsAsNativeInstall,
35
35
  shouldRunClaudeCodeUpdater
36
36
  };
37
- //# sourceMappingURL=claude-code-updater-JQLNRK25.js.map
37
+ //# sourceMappingURL=claude-code-updater-XISTQTZX.js.map
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  redactPaneFrame,
10
10
  sanitizeTerminalFrame
11
- } from "./chunk-KJ5OCCSJ.js";
11
+ } from "./chunk-W2GHPRPZ.js";
12
12
  import {
13
13
  CLAUDE_CONFIG_DIR_ENV,
14
14
  claudeConfigDirFor,
@@ -321,7 +321,7 @@ async function spawnPairSession(session) {
321
321
  return { ok: true };
322
322
  } catch {
323
323
  }
324
- const { resolveClaudeBinary } = await import("./persistent-session-3OES5QXZ.js");
324
+ const { resolveClaudeBinary } = await import("./persistent-session-C7UKT4EE.js");
325
325
  const claudeBin = resolveClaudeBinary();
326
326
  const pairEnv = {
327
327
  ...process.env,
@@ -836,4 +836,4 @@ export {
836
836
  startClaudePair,
837
837
  submitClaudePairCode
838
838
  };
839
- //# sourceMappingURL=claude-pair-runtime-M6VJ3KZ3.js.map
839
+ //# sourceMappingURL=claude-pair-runtime-2EOLNZEY.js.map
@@ -70,7 +70,7 @@ import {
70
70
  tripClass,
71
71
  writeEtcEnvironment,
72
72
  writeProfileDScript
73
- } from "../chunk-GSMGU2QA.js";
73
+ } from "../chunk-DRP3J4CV.js";
74
74
  import {
75
75
  ApiError,
76
76
  adoptHostKeyInProcess,
@@ -88,7 +88,7 @@ import {
88
88
  probeHostKey,
89
89
  requireHost,
90
90
  setConfigHash
91
- } from "../chunk-C3PSUSJ2.js";
91
+ } from "../chunk-ZIAXGM6I.js";
92
92
  import {
93
93
  BLOCKED_ON_PROMPT_DECISION,
94
94
  CHANNEL_SECRET_ENV_KEYS,
@@ -174,7 +174,7 @@ import {
174
174
  webFetchBaselineValue,
175
175
  webFetchRestartNeeded,
176
176
  writeEgressAllowlist
177
- } from "../chunk-GZMUGH6X.js";
177
+ } from "../chunk-6ENTMJ5T.js";
178
178
  import {
179
179
  isAgentIdle,
180
180
  isStaleForToday,
@@ -185,7 +185,7 @@ import {
185
185
  subagentActivityAgeSeconds,
186
186
  subagentTranscriptDir,
187
187
  transcriptActivityAgeSeconds
188
- } from "../chunk-HJWOXFJM.js";
188
+ } from "../chunk-X2FBQPNR.js";
189
189
  import {
190
190
  classifyUnanswerablePane,
191
191
  focusedConfirmDialogBlock,
@@ -209,7 +209,7 @@ import {
209
209
  runSafeCleanup,
210
210
  tightestDiskStat,
211
211
  withPackageCacheLock
212
- } from "../chunk-5BXIXSSH.js";
212
+ } from "../chunk-BMO6GCK2.js";
213
213
  import {
214
214
  parsePsRows,
215
215
  reapOrphanChannelMcps
@@ -337,7 +337,7 @@ import {
337
337
  stabiliseResetInstant,
338
338
  sumTranscriptUsageInWindow,
339
339
  summarizeTranscriptActivity
340
- } from "../chunk-KJ5OCCSJ.js";
340
+ } from "../chunk-W2GHPRPZ.js";
341
341
  import {
342
342
  CLAUDE_CONFIG_DIR_ENV,
343
343
  claudeConfigDirFor,
@@ -14377,7 +14377,7 @@ function createFileMigrationReportIO(codeName, log2) {
14377
14377
  };
14378
14378
  }
14379
14379
  var managerHostPost = async (path, body) => {
14380
- const { api: api2, ApiError: ApiError3 } = await import("../api-client-Q2FXLBH5.js");
14380
+ const { api: api2, ApiError: ApiError3 } = await import("../api-client-LPV5RUCO.js");
14381
14381
  try {
14382
14382
  const json = await api2.post(path, body);
14383
14383
  return { status: 200, json };
@@ -16416,7 +16416,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
16416
16416
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
16417
16417
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
16418
16418
  async function channelInboundActivityAgeSecondsFor(codeName) {
16419
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-BSSNRCPM.js");
16419
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-NV3LXAWL.js");
16420
16420
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
16421
16421
  if (newest === null) return null;
16422
16422
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -17232,7 +17232,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
17232
17232
  var lastVersionCheckAt = 0;
17233
17233
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
17234
17234
  var lastResponsivenessProbeAt = 0;
17235
- var agtCliVersion = true ? "0.28.1264" : "dev";
17235
+ var agtCliVersion = true ? "0.28.1265" : "dev";
17236
17236
  function resolveBrewPath(execFileSync4) {
17237
17237
  try {
17238
17238
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -19241,7 +19241,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
19241
19241
  if (codeNames.length === 0) return;
19242
19242
  void (async () => {
19243
19243
  try {
19244
- const { collectDiagnostics } = await import("../persistent-session-3OES5QXZ.js");
19244
+ const { collectDiagnostics } = await import("../persistent-session-C7UKT4EE.js");
19245
19245
  await api.post("/host/heartbeat", {
19246
19246
  host_id: hostId,
19247
19247
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -19384,7 +19384,7 @@ async function pollCycleInner() {
19384
19384
  }
19385
19385
  try {
19386
19386
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
19387
- const { collectDiagnostics } = await import("../persistent-session-3OES5QXZ.js");
19387
+ const { collectDiagnostics } = await import("../persistent-session-C7UKT4EE.js");
19388
19388
  const diagCodeNames = [...agentState.persistentSessionAgents];
19389
19389
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor) : void 0;
19390
19390
  let tailscaleHostname;
@@ -19655,7 +19655,7 @@ async function pollCycleInner() {
19655
19655
  }
19656
19656
  try {
19657
19657
  const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
19658
- const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-JQLNRK25.js");
19658
+ const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-XISTQTZX.js");
19659
19659
  const securityFloor = currentSecurityFloor();
19660
19660
  claudeUpdaterInFlight = true;
19661
19661
  if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
@@ -19690,7 +19690,7 @@ async function pollCycleInner() {
19690
19690
  collectPanelessActivityProbes,
19691
19691
  getResponsivenessIntervalMs,
19692
19692
  occupancyQualificationClassifications
19693
- } = await import("../responsiveness-probe-BSSNRCPM.js");
19693
+ } = await import("../responsiveness-probe-NV3LXAWL.js");
19694
19694
  const probeIntervalMs = getResponsivenessIntervalMs();
19695
19695
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
19696
19696
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -19807,7 +19807,7 @@ async function pollCycleInner() {
19807
19807
  collectResponsivenessProbes,
19808
19808
  livePendingInboundOldestAgeSeconds,
19809
19809
  parkPendingInbound
19810
- } = await import("../responsiveness-probe-BSSNRCPM.js");
19810
+ } = await import("../responsiveness-probe-NV3LXAWL.js");
19811
19811
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
19812
19812
  const wedgeNow = /* @__PURE__ */ new Date();
19813
19813
  const liveAgents = agentState.persistentSessionAgents;
@@ -20093,7 +20093,7 @@ async function pollCycleInner() {
20093
20093
  }
20094
20094
  }
20095
20095
  );
20096
- const { parkPendingInbound } = await import("../responsiveness-probe-BSSNRCPM.js");
20096
+ const { parkPendingInbound } = await import("../responsiveness-probe-NV3LXAWL.js");
20097
20097
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
20098
20098
  paneFatalStreak.delete(codeName);
20099
20099
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -20124,7 +20124,7 @@ async function pollCycleInner() {
20124
20124
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
20125
20125
  bindSourceEscalations
20126
20126
  } = await import("../transcript-mount-health-OHE6IVJV.js");
20127
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-3OES5QXZ.js");
20127
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-C7UKT4EE.js");
20128
20128
  const mountConfig = resolveTranscriptMountConfig();
20129
20129
  const liveAgents = agentState.persistentSessionAgents;
20130
20130
  for (const tracked of [
@@ -20289,7 +20289,7 @@ async function pollCycleInner() {
20289
20289
  }
20290
20290
  try {
20291
20291
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
20292
- const { probeSessionAuth } = await import("../session-auth-dead-A3TO2N63.js");
20292
+ const { probeSessionAuth } = await import("../session-auth-dead-U62KZ342.js");
20293
20293
  const observations = [];
20294
20294
  const pendingCacheCommits = [];
20295
20295
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -25253,7 +25253,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
25253
25253
  if (!refreshData) return;
25254
25254
  const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
25255
25255
  const hostId = await getHostId();
25256
- const parkForRestart = await import("../responsiveness-probe-BSSNRCPM.js").then(
25256
+ const parkForRestart = await import("../responsiveness-probe-NV3LXAWL.js").then(
25257
25257
  (m) => m.parkPendingInbound,
25258
25258
  (err) => err
25259
25259
  );
@@ -25330,7 +25330,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
25330
25330
  void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
25331
25331
  void (async () => {
25332
25332
  try {
25333
- const { collectDiagnostics } = await import("../persistent-session-3OES5QXZ.js");
25333
+ const { collectDiagnostics } = await import("../persistent-session-C7UKT4EE.js");
25334
25334
  await api.post("/host/heartbeat", {
25335
25335
  host_id: hostId,
25336
25336
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -25383,7 +25383,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
25383
25383
  }
25384
25384
  try {
25385
25385
  const hostId = await getHostId();
25386
- const { collectDiagnostics } = await import("../persistent-session-3OES5QXZ.js");
25386
+ const { collectDiagnostics } = await import("../persistent-session-C7UKT4EE.js");
25387
25387
  await api.post("/host/heartbeat", {
25388
25388
  host_id: hostId,
25389
25389
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -26085,7 +26085,7 @@ async function processClaudePairSessions(agents) {
26085
26085
  snapshotPairConfig,
26086
26086
  // ENG-11659: result -> report body + the manager.log line that records it.
26087
26087
  planPairStartReport
26088
- } = await import("../claude-pair-runtime-M6VJ3KZ3.js");
26088
+ } = await import("../claude-pair-runtime-2EOLNZEY.js");
26089
26089
  const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
26090
26090
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
26091
26091
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
@@ -47347,7 +47347,7 @@ var FLAG_REGISTRY = [
47347
47347
  },
47348
47348
  {
47349
47349
  key: "org-two-factor-enforcement",
47350
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
47350
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
47351
47351
  flagType: "boolean",
47352
47352
  defaultValue: false,
47353
47353
  // Turning it on changes the admission rule for people on the platform's
package/dist/mcp/index.js CHANGED
@@ -32980,7 +32980,7 @@ var FLAG_REGISTRY = [
32980
32980
  },
32981
32981
  {
32982
32982
  key: "org-two-factor-enforcement",
32983
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
32983
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
32984
32984
  flagType: "boolean",
32985
32985
  defaultValue: false,
32986
32986
  // Turning it on changes the admission rule for people on the platform's
@@ -46782,7 +46782,7 @@ var FLAG_REGISTRY = [
46782
46782
  },
46783
46783
  {
46784
46784
  key: "org-two-factor-enforcement",
46785
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
46785
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
46786
46786
  flagType: "boolean",
46787
46787
  defaultValue: false,
46788
46788
  // Turning it on changes the admission rule for people on the platform's
@@ -41637,7 +41637,7 @@ var FLAG_REGISTRY = [
41637
41637
  },
41638
41638
  {
41639
41639
  key: "org-two-factor-enforcement",
41640
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
41640
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
41641
41641
  flagType: "boolean",
41642
41642
  defaultValue: false,
41643
41643
  // Turning it on changes the admission rule for people on the platform's
@@ -42103,7 +42103,7 @@ var FLAG_REGISTRY = [
42103
42103
  },
42104
42104
  {
42105
42105
  key: "org-two-factor-enforcement",
42106
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
42106
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
42107
42107
  flagType: "boolean",
42108
42108
  defaultValue: false,
42109
42109
  // Turning it on changes the admission rule for people on the platform's