From 5f9f6301fa0082467330f352439f06d05cf6d378 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 09:44:16 -0600 Subject: [PATCH] fix(watchdog): check the renamed _openai.main/_openai.alt doors (code#8653 fallout) The #8163 rename (PR #8318) moved the OpenAI doors to the self-contained ids and deleted the retired credential rows, but the credential watchdog kept checking openai.main/openai.alternate - it has reported false VIOLATIONs hourly all morning while never applying the token-sharing invariant to the doors that actually serve. Watch _openai.main (token-sharing ban) and _openai.alt instead; tests updated to the new rename and verified against the live store (invariant holds: both doors chatgpt-headless, exactly one active row each). Deploys with the next generation switch. --- .../openai-cred-watchdog.py | 14 +++++++---- .../openai-cred-watchdog.test.py | 23 ++++++++++--------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/nixos/services/openai-cred-watchdog/openai-cred-watchdog.py b/nixos/services/openai-cred-watchdog/openai-cred-watchdog.py index d8e8e43f80..b4127be6cd 100755 --- a/nixos/services/openai-cred-watchdog/openai-cred-watchdog.py +++ b/nixos/services/openai-cred-watchdog/openai-cred-watchdog.py @@ -2,10 +2,10 @@ """Watchdog: OpenAI credential invariant for the laptop OpenCode store. Invariant (recurrence guard for developing-today/code#3216): - - provider `openai.main`: NO credential row with method + - provider `_openai.main`: NO credential row with method chatgpt-token-sharing may exist, and the ACTIVE credential method must be chatgpt-browser or chatgpt-headless. - - provider `openai.alternate`: the ACTIVE credential method must be + - provider `_openai.alt`: the ACTIVE credential method must be chatgpt-browser or chatgpt-headless. The main account was renamed `openai` -> `openai.main` in PR #5085; @@ -13,6 +13,12 @@ #5250): a store still carrying only `openai` rows reports `openai.main: no credential rows found` rather than passing. +Rename 2 (2026-11-11, PR #8318, issue #8163): both doors were +renamed to the self-contained ids `_openai.main` / `_openai.alt` +and the retired rows were deleted. This watchdog kept checking +the retired ids for a full morning afterwards and reported +false violations hourly (fallout recorded on issue #8653). + Read-only. Never prints token values (only credential ids, labels, methods). Exit: 0 healthy, 1 violation, 2 check error. Usage: openai-cred-watchdog.py [path-to-opencode.db] @@ -26,7 +32,7 @@ DEFAULT_DB = os.path.expanduser("~/.local/share/opencode/opencode.db") ALLOWED_ACTIVE_METHODS = {"chatgpt-browser", "chatgpt-headless"} BANNED_METHOD = "chatgpt-token-sharing" -PROVIDERS = ("openai.main", "openai.alternate") +PROVIDERS = ("_openai.main", "_openai.alt") def method_of(value_json): @@ -58,7 +64,7 @@ def check(db_path): if not creds: violations.append(f"{provider}: no credential rows found") continue - if provider == "openai.main": + if provider == "_openai.main": for cred_id, label, active, method in creds: if method == BANNED_METHOD: violations.append( diff --git a/nixos/services/openai-cred-watchdog/openai-cred-watchdog.test.py b/nixos/services/openai-cred-watchdog/openai-cred-watchdog.test.py index 48f460c412..97992cabf7 100755 --- a/nixos/services/openai-cred-watchdog/openai-cred-watchdog.test.py +++ b/nixos/services/openai-cred-watchdog/openai-cred-watchdog.test.py @@ -71,40 +71,41 @@ def check_rows(self, rows): os.unlink(path) def test_providers_are_the_renamed_identities(self): - self.assertEqual(watchdog.PROVIDERS, ("openai.main", "openai.alternate")) + self.assertEqual(watchdog.PROVIDERS, ("_openai.main", "_openai.alt")) def test_healthy_renamed_store_passes(self): violations = self.check_rows( [ - ("openai.main", True, "chatgpt-browser"), - ("openai.alternate", True, "chatgpt-headless"), + ("_openai.main", True, "chatgpt-browser"), + ("_openai.alt", True, "chatgpt-headless"), ] ) self.assertEqual(violations, []) - def test_banned_method_on_openai_main_is_flagged(self): + def test_banned_method_on_renamed_main_is_flagged(self): violations = self.check_rows( [ - ("openai.main", True, "chatgpt-browser"), - ("openai.main", False, "chatgpt-token-sharing"), - ("openai.alternate", True, "chatgpt-headless"), + ("_openai.main", True, "chatgpt-browser"), + ("_openai.main", False, "chatgpt-token-sharing"), + ("_openai.alt", True, "chatgpt-headless"), ] ) self.assertTrue( any( - v.startswith("openai.main:") and "banned" in v for v in violations + v.startswith("_openai.main:") and "banned" in v for v in violations ), - f"expected a banned-method violation for openai.main, got {violations}", + f"expected a banned-method violation for _openai.main, got {violations}", ) - def test_retired_openai_only_store_does_not_pass(self): + def test_retired_ids_only_store_does_not_pass(self): violations = self.check_rows( [ ("openai", True, "chatgpt-browser"), ("openai.alternate", True, "chatgpt-headless"), ] ) - self.assertIn("openai.main: no credential rows found", violations) + self.assertIn("_openai.main: no credential rows found", violations) + self.assertIn("_openai.alt: no credential rows found", violations) if __name__ == "__main__":