Repository navigation
refactor(llc): config consolidation + LLCRunStatus.is_terminal() + middleware dedup + fix broken test (#9776, #9777, #9763) - #9829
Merged
Conversation
…tion + fix broken test (#9776, #9777, #9763) #9776 — llc/config.py was shadowed by the llc/config/ package (dead module; DEFAULT_STREAMING_WATCHDOG_TIMEOUT unreachable, AGENT_API_BASE_URL duplicated). Folded the unique constant into config/__init__.py and deleted the flat module; all three constants now import cleanly. #9777 — added LLCRunStatus.is_terminal() as the single source of truth for the terminal/non-terminal split, replacing the scheduler's _NONTERMINAL_STATUSES and the subscription adapters' ad-hoc `in (COMPLETED, FAILED)` checks. The agent-auth middleware now delegates to ApiKeyService.validate_key (hash + revoked + expiry) instead of re-implementing the query/hash — the two can no longer drift. #9763 — test_invoke_writes_state_file patched builtins.open then asserted the state file exists on disk (impossible). Dropped the open patch so the file is written for real to the temp dir; the assertion is now meaningful. Adds tests for is_terminal() (partition totality) and the auth middleware (passthrough / 401 / valid-key delegation) — the middleware had no tests before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
This was referenced Jun 9, 2026
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.
Thinking Path
Three related LLC-hygiene gaps surfaced while auditing the heartbeat/adapter work: a shadowed dead config module (#9776), duplicated terminal-status + key-validation logic (#9777), and a structurally-broken test (#9763). Grouped here as one focused hygiene PR.
What Changed
#9776 — config consolidation
llc/config.py(flat) was shadowed by thellc/config/package, so it was dead and itsDEFAULT_STREAMING_WATCHDOG_TIMEOUTwas unreachable (ImportError). Folded the constant intoconfig/__init__.pyand deleted the flat module. All three constants now import.#9777 — consolidation
LLCRunStatus.is_terminal()is now the single source of truth for the terminal/non-terminal split — replaces the scheduler's_NONTERMINAL_STATUSESfrozenset and the two subscription adapters'in (COMPLETED, FAILED)checks.agent_authmiddleware now callsApiKeyService.validate_key(hash + revoked + expiry) instead of re-implementing the query +_hash_key— the very duplication that forced the two-placeexpires_atedit in feat(llc/scheduler): route claude_code heartbeats through adapter registry + run-scoped key (#9622, #9623) #9772. They can no longer drift.#9763 — broken test
test_invoke_writes_state_filepatchedbuiltins.openthen asserted the state file exists on disk (impossible). Dropped the patch so the file is written for real to the temp dir.Verification
Zero failures — the previously-perennial
test_invoke_writes_state_file(#9763) now passes. New tests:test_run_status_terminal.py(terminal/non-terminal partition is total) andtest_agent_auth_middleware.py(passthrough / missing-bearer 401 / invalid-key 401 viavalidate_key/ valid-key setsrequest.state) — the middleware had no tests before.Closes #9776. Closes #9777. Closes #9763.
Model Used
claude-opus-4-8 (1M context)