Repository navigation
feat(config): close the 5-layer resolution gap with ResolvedRuntimeConfig - #3079
Conversation
…et_index_config signatures The original patch's config.py deletion of the zero-arg get_sources/ get_drive_config/get_index_config/get_config broke ~20 real call sites it never touched (devtools scripts, daemon/cli.py, demo/workspace.py, tests) -- grepped every caller to confirm. Two of those call sites (demo/workspace.py, daemon/cli.py) and their tests specifically mock/patch a zero-argument get_config(); tests/unit/core/test_config.py's own docstring says the one-argument get_index_config(runtime)/get_sources(runtime)/ get_drive_config(runtime) 'over an explicitly resolved ResolvedRuntimeConfig is the replacement' -- so the two conventions are BOTH intentional, just for different functions. Restored: get_config() stays zero-arg (delegates to resolve_runtime_config().as_config()); get_sources/get_drive_config/ get_index_config take the runtime argument the tests actually expect, with no remaining zero-arg caller. Also documented 11 newly-surfaced config keys in docs/configuration.md (docs-coverage gate) and fixed a stale mypy 1.20.1/uv.lock 2.3.0 devshell mismatch (ran mypy/ruff via .venv/bin/ explicitly to get the pinned version).
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis change introduces captured, immutable runtime configuration resolution and propagates it through configuration projections, services, Polylogue, CLI, MCP server construction, diagnostics, and tests. Documentation now lists additional configuration keys and Drive OAuth path overrides. ChangesResolved runtime configuration
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1248f7a5ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| use_plain = should_use_plain( | ||
| plain=plain, | ||
| force_plain=runtime.settings.force_plain, | ||
| no_color=runtime.settings.no_color, | ||
| ) |
There was a problem hiding this comment.
Preserve NO_COLOR presence semantics
With NO_COLOR=0 or NO_COLOR=false, runtime.settings.no_color is False because the config layer treats NO_COLOR as a boolean, so this path re-enables Rich/ANSI output even though the NO_COLOR convention and the previous no_color_requested() behavior disabled color for any non-empty value. This affects CLI invocations in environments that set NO_COLOR to a placeholder value rather than 1; pass through presence separately or special-case this key before using it to choose plain mode.
Useful? React with 👍 / 👎.
…, misc-01 r01-loose) mandate-01 integrated (PR #3088, 91 focused tests green after rebase integration); ann-04 filed as needs_rebase_review (41ow judgment transaction, patch conflicts with moved master — adjudication input for the 41ow lane item); misc-01 loose-file second copy recorded as superseded by merged #3079. Clipboard FINAL-SUMMARY for ann-04 captured alongside its loose files. Wave 2 custody now covers 32/32 missions + mandate/support portfolio. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ
Custody-only: receipts + index entries for mandate-01 (integrated via PR #3088), ann-04 (needs_rebase_review — 41ow judgment transaction), misc-01 loose-file second copy (superseded by #3079). No code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ Co-authored-by: Claude Fable 5 <[email protected]>
…lution deliveries Ref polylogue-41ow, polylogue-fd2s, polylogue-9gh1, polylogue-2o3d Problem: two files staged at /realm/tmp/gpt-pro-intake-0719/ (judgment-*.md/.diff, config-*.md/.diff) were flagged as fresh wave-2 deliveries needing triage, targeting snapshot 536a53e (#3046). Master has since moved ~180 commits including 33 merges. Solution: verified pairing first (judgment-* files cross-reference polylogue-41ow/37t.12/mrxt and match mission ann-04; config-* files cross-reference polylogue-fd2s/9gh1 and match mission misc-01). SHA-256 of every file was then found byte-identical to the already-recorded results/ann-04/r01 and results/misc-01/r01 packages -- these are not new deliveries, they are exact re-submissions of packages already triaged 2026-07-18. Re-verified git apply --check against both the stated snapshot (passes cleanly for both) and current origin/master (fails on every production file for both -- confirms drift). Cross-referenced current source against each package's claims: - ann-04 (judgment-transaction): bd polylogue-41ow (closed, PR #3101+#3110) independently fixed the writer-slot TOCTOU race; bd polylogue-2o3d (closed, PR #3138) independently ported the delivery's entire additive scope (evidence previews, queue health, judge consolidation, capture idempotency) after its own line-by-line audit. Supersession is now total, not partial as r01 judged it before those PRs landed. Recorded as r02 (state=superseded). - misc-01 (config-resolution-closure): PR #3079 (merged 2026-07-18, explicitly sourced from an earlier revision of this same packet family) already shipped ResolvedRuntimeConfig/single-resolver/archive_root-fix. Live-checked polylogue/config.py:1514 -- deep-merge for nested health tables (polylogue-cxlk) is already landed. Genuine residual found: uu8r-scope env-bypass migrations (daemon/backup.py, pipeline/services/archive_ingest.py, and ~5-6 more files this delivery's own bypass-caller table names) are still unmigrated on current master, but must be re-derived against the already-landed config API rather than applying this patch's hunks (no shared ancestor). Recorded as r02 (state=superseded, with residual noted for polylogue-uu8r). Verification: sha256sum on all 8 delivered files cross-checked against existing r01 records (identical); git apply --check run against both 536a53e (clean) and origin/master e963e87 (fails, 20-73 files per patch); bd show on polylogue-41ow/fd2s/9gh1/cxlk/uu8r/2o3d to confirm current close/open state and what each merged PR actually covers; grep -rl ResolvedRuntimeConfig and read of _merge_toml/_deep_merge_table in polylogue/config.py to confirm the architecture is live, not just claimed. Triage notes appended to polylogue-41ow and polylogue-fd2s via bd update --append-notes. No patch was applied to master; no bead was closed or reopened by this change. Co-Authored-By: Claude <[email protected]>
… deliveries Ref polylogue-41ow, polylogue-fd2s, polylogue-9gh1, polylogue-2o3d Problem: two files staged at /realm/tmp/gpt-pro-intake-0719/ (judgment-*.md/.diff, config-*.md/.diff) were flagged as fresh wave-2 deliveries needing triage, targeting snapshot 536a53e (#3046). Master has since moved ~180 commits including 33 merges. Solution: verified pairing first (judgment-* files cross-reference polylogue-41ow/37t.12/mrxt and match mission ann-04; config-* files cross-reference polylogue-fd2s/9gh1 and match mission misc-01). SHA-256 of every file was then found byte-identical to the already-recorded results/ann-04/r01 and results/misc-01/r01 packages -- these are not new deliveries, they are exact re-submissions of packages already triaged 2026-07-18. Per results/README.md custody policy ("Duplicated browser downloads with identical SHA-256 values are deliberately not copied twice", precedent: lin-01/r01), this revision does NOT mint a second package-revision identity (r02) or duplicate the raw/extracted artifact bytes. Instead the 2026-07-20 reassessment is recorded as a dated `reassessments` entry inside each existing r01 receipt.json, alongside an updated top-level `state` where the evidence changed: - ann-04/r01: state needs_rebase_review -> superseded. bd polylogue-41ow (closed, PR #3101+#3110) independently fixed the writer-slot TOCTOU race; bd polylogue-2o3d (closed, PR #3138) independently ported the delivery's entire additive scope (evidence previews, queue health, judge consolidation, capture idempotency) after its own line-by-line audit found the MCP-surface hunks obsolete (six-tool cutover) and the delivery's transaction mechanism redundant with #3101. Supersession is now total, not partial as originally judged before those PRs landed. - misc-01/r01: state stays superseded, rationale now explicit. PR #3079 (merged 2026-07-18, sourced from an earlier revision of this same packet family) already shipped ResolvedRuntimeConfig/single-resolver/ archive_root-fix/deep-merge. There is no viable rebase target for this patch against the current config API -- #3079 shipped a differently shaped ResolvedRuntimeConfig with no common ancestor, so any further work must be re-derived, not revived from this diff. The genuine residual (uu8r-scope env-bypass migrations, e.g. daemon/backup.py, pipeline/services/archive_ingest.py, still unmigrated on master) is tracked durably as polylogue-uu8r directly, not as a pending state on this package. Re-verified git apply --check against both the stated snapshot (passes cleanly for both) and current origin/master, checked twice: once at the original triage base (e963e87) and again after rebasing onto the latest tip (1c0f4ec, three commits later -- #3175 CLI onboarding convergence plus two beads-filing commits, none touching the affected files). Both patches fail identically both times. Verification: sha256sum on all 8 delivered files cross-checked against existing r01 records (identical); git apply --check as above; bd show on polylogue-41ow/fd2s/9gh1/cxlk/uu8r/2o3d to confirm current close/open state and what each merged PR actually covers; grep -rl ResolvedRuntimeConfig and read of _merge_toml/_deep_merge_table in polylogue/config.py to confirm the architecture is live, not just claimed; devtools verify --quick 16/16 green (pre-push hook). Triage notes appended to polylogue-41ow and polylogue-fd2s via bd update --append-notes, including a correction note for the earlier (superseded) r02 framing. No patch was applied to master; no bead was closed or reopened by this change. Co-Authored-By: Claude <[email protected]>
…lution deliveries (#3177) ## Summary Re-triages two ChatGPT-Pro handoff packages staged at `/realm/tmp/gpt-pro-intake-0719/` (`judgment-*.md/.diff`, `config-*.md/.diff`), targeting snapshot `536a53efac0cbe4a2473ad379e4db49ef3fce74d` (#3046). Both are byte-identical duplicate downloads of packages already on file as `results/ann-04/r01` and `results/misc-01/r01`. Per the custody policy (`results/README.md`: "Duplicated browser downloads with identical SHA-256 values are deliberately not copied twice", precedent: `lin-01/r01`), this PR does **not** mint a second package-revision identity or duplicate raw/extracted artifact bytes — it records the 2026-07-20 reassessment as a dated `reassessments` entry inside each existing `r01` receipt, with the top-level `state` updated where the evidence changed. No patch is applied to master; no bead is closed or reopened. ## Problem Both files were flagged as fresh wave-2 deliveries needing triage. Master has moved ~180 commits (33+ merges) past the stated snapshot. ## Solution **Pairing verification (step 0):** `judgment-*` files cross-reference polylogue-41ow/37t.12/mrxt and match mission `ann-04-judgment-transaction`; `config-*` files cross-reference polylogue-fd2s/9gh1 and match mission `misc-01-config-closure`. The mapping was correct as staged. **Commission identification (step 1):** both missions already have `r01` result entries on disk. SHA-256 of every one of the 8 delivered files is byte-identical to the corresponding `results/ann-04/r01` and `results/misc-01/r01` artifacts (`diff -q` reports no differences) — these are re-submissions of packages already triaged 2026-07-18, not new deliveries. **Triage (step 2), recorded as `reassessments` entries in the existing `r01` receipts:** - `git apply --check` passes cleanly for both patches against the stated snapshot (integrity confirmed) and fails for both against current `origin/master`, re-checked three times as master advanced during triage (`e963e87f5` → `1c0f4eccd` → `610ce8d9`, none of the intervening commits touch the affected core files). - **ann-04 (judgment-transaction): `r01` state `needs_rebase_review` → `superseded`.** bd `polylogue-41ow` (closed, PR #3101+#3110) independently fixed the writer-slot TOCTOU race; bd `polylogue-2o3d` (closed, PR #3138) independently ported the delivery's entire non-overlapping additive scope (evidence previews, queue health, judge-command consolidation, capture idempotency) after its own line-by-line audit found the MCP-surface hunks obsolete (six-tool cutover) and the delivery's transaction mechanism redundant with #3101. Supersession is now total — every acceptance-matrix row this delivery claims already has an independent, merged, adjudicated master implementation. - **misc-01 (config-resolution-closure): `r01` state stays `superseded`, rationale now explicit.** PR #3079 (merged 2026-07-18, explicitly sourced from an earlier revision of this same GPT-Pro packet family) already shipped `ResolvedRuntimeConfig`, the single resolver, the `archive_root` TOML fix, and deep-merge for nested health tables (live-checked `polylogue/config.py:1514` `_merge_toml`/`_deep_merge_table`). `needs_rebase_review` does not apply here: there is no viable rebase target for this patch against the current config API — #3079 shipped a differently-shaped `ResolvedRuntimeConfig` with no common ancestor, so any further work must be **re-derived against the landed API, not revived** from this diff. The genuine residual (bd `polylogue-uu8r`'s env-bypass migration scope — spot-checked `polylogue/daemon/backup.py:695` and `polylogue/pipeline/services/archive_ingest.py:48`, both still direct `os.environ.get()` reads on master) is tracked durably as `polylogue-uu8r` directly, not as a pending state on this package. Also noted, out of scope for this PR: `polylogue-fd2s`/`polylogue-9gh1` still read `status=open` in `bd` despite #3079's landing — likely bookkeeping lag, flagged in the bead notes for a separate housekeeping pass. A stray `clipboard-current.txt` in the intake directory is unrelated leftover clipboard text for the already-integrated `mandate-01` delivery (same SHA as `results/mandate-01/r01`, PR #3088, merged) — not part of either package, not touched by this PR. ## Verification - `sha256sum` on all 8 delivered files, cross-checked against existing `r01` records: identical. - `git apply --check` against `536a53efac0cbe4a2473ad379e4db49ef3fce74d`: clean for both patches (detached worktree). - `git apply --check` against `origin/master`, checked at `e963e87f5`, `1c0f4eccd`, and `610ce8d9` as master advanced during triage: fails identically every time (20 production files for judgment, 21 for config; some judgment files/tests no longer exist post six-tool MCP cutover). - `bd show polylogue-41ow/fd2s/9gh1/cxlk/uu8r/2o3d --json` to confirm current close/open state and what each merged PR actually covers. - `grep -rl ResolvedRuntimeConfig polylogue/` plus a read of `polylogue/config.py:1514` (`_merge_toml`/`_deep_merge_table`) to confirm the architecture is live on master, not just claimed by a PR title. - `devtools verify --quick`: 16/16 green (pre-push hook, this branch, each push). - Triage notes appended to `polylogue-41ow` and `polylogue-fd2s` (plus a correction note on both retracting the earlier, policy-violating `r02` framing) via `bd update --append-notes` + `bd export`. Ref polylogue-41ow, polylogue-fd2s, polylogue-9gh1, polylogue-2o3d Co-authored-by: Claude <[email protected]>
…olver (#3243) ## Summary Lands the uu8r-class piece of the polylogue-9gh1 epic (config.py's documented 5-layer precedence vs actual runtime behavior) plus the fixture-driven regression test the epic's design requires across all three named bug shapes. The other two pieces (fd2s split-system delegation, cxlk nested-table deep-merge) were already fixed on master via PR #3079 before this branch was cut; this PR adds the regression coverage that was still missing for them and lands new fixes for the remaining env-bypass class. ## Problem `investigations/config-resolution.md` (dogfood-2 round-2) found config.py's documented 5-layer precedence (defaults -> site TOML -> user TOML -> POLYLOGUE_* env -> CLI) silently does not hold for the whole inventoried surface, in three structurally distinct ways: 1. **fd2s-class** (split-system delegation) -- already fixed on master (PR #3079, `resolve_runtime_config`/`ResolvedRuntimeConfig`). 2. **cxlk-class** (nested-table full-replace) -- already fixed on master (`_deep_merge_table` in `polylogue/config.py:1749`). 3. **uu8r-class** (direct `os.environ` bypass) -- ~20 files read genuinely POLYLOGUE_*-namespaced, TOML-backed settings straight from `os.environ` instead of `load_polylogue_config()`, so TOML/site/user layering never reached those call sites even though every one of the settings involved was already fully inventoried in `config.py`. None of the three bug shapes had regression coverage: `grep` for `_deep_merge_table`/`health_convergence_debt`/`ResolvedRuntimeConfig` across `tests/unit/core/test_config.py` before this PR turns up construction/precedence tests for flat scalar keys only, nothing that would fail if the nested-merge or delegation fixes were reverted. ## Solution **Commit 1** (`fix(config): ...`) migrates 17 files' direct `os.environ.get(...)` reads for already-inventoried settings to `load_polylogue_config()` (or an already-resolved `Config`/`IndexConfig` object first, falling back to the layered resolver where one is in scope): `daemon_url` (6 call sites: `cli/commands/{dashboard,import_command,status,tutorial}.py`, `daemon/cli.py`), `no_daemon`/`daemon_client_mode` (`cli/archive_query.py`, `cli/commands/facets.py`), `voyage_api_key` (3 residual call sites: `cli/commands/embed.py`, `pipeline/run_stages.py`, `storage/search_providers/__init__.py`), `theme` (`ui/theme.py`), `backup_verify_tmpdir` (`daemon/backup.py`), `antigravity_language_server` (`sources/parsers/antigravity.py`), `drive_credentials_path`/`drive_token_path` (`sources/drive/auth.py`), `live_full_ingest_workers` (`sources/live/batch_support.py`), `schema_validation`/`ingest_commit_batch_messages` (`pipeline/services/ingest_batch/_core.py`, `pipeline/services/archive_ingest.py`). `load_polylogue_config` remains the sole five-layer resolver per the fd2s/testsuite-diet contract -- no second resolution path was introduced. Two non-obvious subtleties, handled explicitly: - Some inventoried settings (`daemon_url`, `drive_credentials_path`, `drive_token_path`) have a non-empty **default-layer** value, so a bare truthiness check on the resolved value can't distinguish "explicitly configured" from "using the built-in default shape". Call sites that need that distinction (`status.py`'s daemon-port discovery skip, `drive/auth.py`'s config -> env -> XDG-default -> prompt chain) now check `PolylogueConfig.layer_of(key) != "default"` instead. - An empty-string `POLYLOGUE_DAEMON_URL` is a valid env-layer value under `_apply_env_overrides`, but existing call sites treated an empty override as "unset, use the built-in URL" (`tests/unit/cli/commands/test_status.py::test_empty_env_var_returns_builtin`). Preserved that per-call-site behavior with an explicit `or <builtin>` rather than changing empty-string-env semantics globally. Also fixed a latent `AttributeError` in `pipeline/run_stages.py::execute_embed_stage` (assumed `config.index_config` always exists; some test/lightweight callers pass a stand-in without it) via `getattr(config, "index_config", None)`. **Commit 2** (`test(config): ...`) adds `tests/unit/core/test_config_resolution_regression.py`: three test classes, one per bug shape, each exercising a *real* runtime consumer (not a synthetic replica): - `TestNestedTableDeepMergePreservesSiblings` (cxlk-class): a two-layer TOML fixture (site sets `default_warning`+`default_error`+two family overrides; user overrides only `default_error`) asserts both the raw merged dict and `daemon.convergence_debt_alert.load_thresholds_from_config` / `daemon.cursor_lag_alert.load_thresholds_from_config` retain the site layer's siblings. - `TestDelegatedSettingsReachRealConsumers` (fd2s-class): TOML-only `archive.root` reaches `resolve_runtime_config().paths.archive_root`; TOML-only `embedding.voyage_api_key` (no env var) reaches `create_vector_provider`'s actual `SqliteVecProvider` construction. - `TestDirectEnvBypassCallersRouteThroughResolver` (uu8r-class): TOML-only `maintenance.backup_verify_tmpdir` reaches `daemon.backup._backup_verification_scratch_parent`; TOML-only `sources.antigravity.language_server` reaches `sources.parsers.antigravity.discover_language_server`. Each class's docstring states the exact reverted mutation that makes its test(s) fail; all were manually verified (reverted, re-ran, confirmed failure, restored). ## Verification - `ruff check` / `ruff format --check` on all 18 touched files: clean. - `mypy --strict` on all 18 touched files: `Success: no issues found in 18 source files`. - `devtools test tests/unit/core/test_config_resolution_regression.py`: 6 passed. - Manual reverted-mutation witnesses (documented in the test docstrings, executed and confirmed): reverting `_deep_merge_table` to a shallow `{**existing, **incoming}` fails both nested-table tests with `KeyError` on the dropped sibling key; reverting any of the three env-bypass fixes (`search_providers`, `backup.py`, `antigravity.py`) fails the corresponding delegated/env-bypass test; reverting `resolve_runtime_config`'s `archive_root` wiring fails the archive-root delegation test. - `devtools test` across the touched surface's existing test files (`tests/unit/cli/test_{archive_query,dashboard_command,embed,embed_activation,embed_status_fast,import,status,tutorial}.py`, `tests/unit/cli/commands/test_status.py`, `tests/unit/cli/test_status_diagnostics.py`, `tests/unit/archive/test_facets.py`, `tests/unit/daemon/{test_backup,test_daemon_cli}.py`, `tests/unit/cli/test_backup_command.py`, `tests/unit/pipeline/{test_run_stages_runtime,test_archive_ingest_commit_batching}.py`, `tests/unit/core/{test_health_core,test_config,test_config_resolution_regression}.py`, `tests/unit/cli/test_auth.py`, `tests/unit/sources/{test_drive_auth,test_live_batch_support,test_antigravity_language_server}.py`, `tests/unit/sources/parsers/test_antigravity.py`, `tests/unit/storage/test_vec.py`, `tests/unit/cli/test_theme_aliases_help_markdown.py`): 853 passed, 5 failures -- all 5 reproduced identically with the diff reverted (`git stash`), confirming they are pre-existing/unrelated: `test_status.py::test_archive_facade_route_catalog_covers_public_async_facade` (unrelated route-catalog drift), `test_dashboard_command.py::test_dashboard_default_prints_evidence_before_launching_tui` (`ConfigError('RuntimeServices has no config projection')`, unrelated to daemon_url), and three `test_import.py` demo-fixture-world convergence failures. - `devtools verify --quick` ran automatically via the pre-push hook: exit 0. - Attempted a full `devtools verify --seed-testmon --skip-slow` in the background; it did not finish within a 590s budget and showed widespread failures across modules this PR does not touch, consistent with concurrent-session resource contention on this shared checkout (multiple other agent worktrees were running tests in parallel at the time) rather than this diff -- not chased further per the repo's testmon-inner-loop verification policy (targeted-file selection over blanket full-suite runs). ## AC matrix (epic polylogue-9gh1) | AC | Status | | --- | --- | | Every setting inventoried with a `toml_path` respects site/user TOML precedence for its real runtime consumer (fd2s-class) | Satisfied on master via PR #3079; this PR closes 3 residual `VOYAGE_API_KEY` bypass call sites the earlier PR didn't reach and adds regression coverage | | Nested-table settings deep-merge across layers, preserving unrelated sibling keys (cxlk-class) | Satisfied on master (`_deep_merge_table`); this PR adds the regression test that was missing | | ~20 genuinely-bypassing files route through the layered resolver (uu8r-class) | Partially satisfied: 17 files / ~15 distinct settings migrated in this PR. Deferred-with-reason below | | A regression test fixture exercises all three shapes | Satisfied: `tests/unit/core/test_config_resolution_regression.py`, one class per shape, real-consumer assertions, reverted-mutation witnesses documented and manually verified | **Deferred-with-reason (uu8r remaining scope):** ~7-8 files read POLYLOGUE_*-namespaced settings that are **not yet in the config.py inventory at all** -- `POLYLOGUE_DEV_LOOP_RUN_ID`/`POLYLOGUE_DEV_LOOP_LOG_DIR` (`daemon/cli.py`, `daemon/http.py`), `POLYLOGUE_HOOK_PROVIDER` (`hooks/__init__.py`), `POLYLOGUE_RAW_AUTHORITY_COMMIT_BATCH_SIZE` (`storage/repair.py`), `POLYLOGUE_DAEMON_PARSE_STAGE_{WORKERS,MAX_INFLIGHT_BYTES,MAX_CACHED_TREE_BYTES,WARM_TIMEOUT_SECONDS}` (`daemon/parse_prefetch.py`), `POLYLOGUE_SESSION_REF` (`coordination/envelope.py`), `POLYLOGUE_REVISION_PARSE_{DISPATCH_MAX_BYTES,POOL_MIN_BYTES}` (`sources/revision_backfill.py`). These need new `ConfigInventoryEntry` rows plus a `render` regen (docs/openapi/cli-output-schemas) before a caller migration is meaningful -- a distinct, larger unit of work from routing the ~15 settings that were already inventoried but bypassed, which this PR completes. Recommend claiming the remainder directly under polylogue-uu8r. Ref polylogue-9gh1, polylogue-uu8r Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
….py (#3248) ## Summary Lands the residual polylogue-uu8r-class scope PR #3243 explicitly deferred: 8 genuinely `POLYLOGUE_*`-namespaced settings that had **no config-inventory entry at all** (distinct from an already-inventoried key whose caller merely bypassed the resolver — that class was closed by #3243). Re-derived the file list live against master with `rg 'os\.environ.*POLYLOGUE_' polylogue/` rather than trusting the bead's stale 31-file/7-8-file counts, which had drifted after #3243 and #3079 landed. ## Problem `investigations/config-resolution.md`'s dogfood-2 round-2 config investigation found `config.py` documents a 5-layer TOML/env precedence system, but several settings bypassed it entirely because they were never inventoried in the first place — so TOML could never reach them regardless of caller migration: - `POLYLOGUE_HOOK_PROVIDER` (hook-harness detection override) - `POLYLOGUE_RAW_AUTHORITY_COMMIT_BATCH_SIZE` (raw-materialization repair batching) - 4 daemon parse-stage prefetch knobs: `POLYLOGUE_DAEMON_PARSE_STAGE_{WORKERS,MAX_INFLIGHT_BYTES,MAX_CACHED_TREE_BYTES,WARM_TIMEOUT_SECONDS}` - 2 revision-parse dispatch thresholds: `POLYLOGUE_REVISION_PARSE_{DISPATCH_MAX_BYTES,POOL_MIN_BYTES}` ## Solution - Added 8 `ConfigInventoryEntry` rows to `polylogue/config.py` plus matching `PolylogueConfig` properties, `_default_config_values` defaults, and `_INT_CONFIG_KEYS`/`_FLOAT_CONFIG_KEYS` coercion entries, following existing `owner_class`/`reload_behavior` conventions (mirrors the `ingest_commit_batch_messages`/`daemon_parse_stage_split` siblings). - Migrated each call site's `os.environ.get(...)` read to `load_polylogue_config().<key>`, preserving each function's existing "explicit override wins, invalid/absent falls back to the module default" semantics exactly — no behavior change for unconfigured deployments. - Documented all 8 new keys in `docs/configuration.md` (TOML-key table + env-var quick-reference table). ### Per-setting judgment table | Setting | Decision | Rationale | | --- | --- | --- | | `hook_provider` | **Inventoried** (`sources.hook_provider`) | Operator-settable harness-detection override, same shape as the `theme` reference pattern (env wins, falls to TOML otherwise). | | `raw_authority_commit_batch_size` | **Inventoried** (`pipeline.raw_authority.commit_batch_size`) | Genuine perf tunable, direct sibling of `ingest_commit_batch_messages`. | | `daemon_parse_stage_workers` / `max_inflight_bytes` / `max_cached_tree_bytes` / `warm_timeout_seconds` | **Inventoried** (`daemon.raw_materialization.parse_stage_*`) | Daemon-owned resource-policy knobs, direct siblings of `daemon_parse_stage_split`; read from `DaemonParseStage.__init__` in-process (ThreadPoolExecutor, never a spawned worker) — no multiprocessing-spawn hazard. | | `revision_parse_dispatch_max_bytes` / `pool_min_bytes` | **Inventoried** (`pipeline.revision_parse.*`) | Perf-tuning thresholds with measured rationale in their docstrings; read in dispatcher/orchestration code before `ProcessPoolExecutor` creation, never inside a worker — no spawn hazard. | | `POLYLOGUE_DEV_LOOP_RUN_ID` / `POLYLOGUE_DEV_LOOP_LOG_DIR` | **Intentional env-only exemption** | Launcher-injected correlation metadata for one process invocation, structurally identical to `CODEX_SESSION_ID`/`CLAUDE_SESSION_ID` (already out of the config domain), not an operator TOML preference. Documented at each call site + `docs/configuration.md`. | | `POLYLOGUE_SESSION_REF` | **Intentional env-only exemption** | Same class as above — grouped with `CODEX_THREAD_ID`/`CODEX_SESSION_ID`/`CLAUDE_SESSION_ID` in `coordination/envelope.py`. | | `POLYLOGUE_CONFIG` | **Intentional bootstrap-only exemption** | Selects *which* user TOML file the layered resolver loads, so it cannot itself be resolved through that resolver — mirrors `config.py`'s own `_user_config_path`/`_site_config_path` bootstrap reads. | | `POLYLOGUE_ARCHIVE_ROOT` in `daemon/http.py::_dev_loop_payload` | **Left raw (diagnostic probe)** | `archive_root` itself IS inventoried, but this endpoint reports whether the daemon's *own environment* has the var set (launcher diagnosis), not a config value; routing through the resolver would mask an unset env var behind the TOML/default fallback and defeat the probe's purpose. | ## Verification - `devtools test tests/unit/core/test_config_resolution_regression.py`: 16 passed (6 pre-existing fd2s/cxlk/uu8r-class + 10 new — one regression class per newly-inventoried setting family, against its real consumer, each with a revert-witness docstring). Live-verified the raw-authority witness by reverting that call site to `os.environ.get` and confirming the test fails (`20 != 4242`) before restoring the fix. - Touched-consumer files, run individually: `test_config.py` (95), `test_config_inventory.py` (60), `test_hooks.py` (8), `test_repair.py` (55), `test_revision_backfill.py` (44), `test_parse_prefetch.py` (12), `test_envelope.py` (26), `test_embed.py` (18), `test_backup.py` (23) — all passed. - `devtools verify --quick`: ruff format/check, mypy --strict, `render all --check` (grepped for "out of sync": none), topology/layering/closure-matrix, docs-coverage, and the rest of the quick gate all green (`exit_code: 0`), both standalone and via the pre-push hook. ## AC matrix (polylogue-uu8r) | AC | Status | | --- | --- | | Every direct `os.environ` POLYLOGUE_* read outside `config.py` is classified | Satisfied — re-derived via `rg`, 7 files / 8 settings genuinely un-inventoried; 4 settings classified as intentional env-only/bootstrap exemptions with rationale documented at call sites + docs. | | All class-(a) (genuine TOML-backed) sites route through `config.py` | Satisfied — 8 settings, 7 files. | | Config diagnostics output includes the migrated settings | Satisfied — driven automatically from `_CONFIG_INVENTORY` (`config_inventory_payload`, `_toml_section_layout`, `_ENV_CONFIG_KEY_MAP` all derive from the inventory list). | | `devtools test` on affected files + `config.py` passes | Satisfied — see Verification above. | Ref polylogue-uu8r; last open child of polylogue-9gh1. --------- Co-authored-by: Claude <[email protected]>
…k bool env vars (#3340) ## Summary Fresh `devtools verify --all` re-triage of polylogue-p6rz ("pre-existing test failures unrelated to MCP cutover") against current master. Fixes several confirmed real regressions and stale test assertions found during the pass; files properly-scoped follow-up beads for the rest instead of leaving them as anonymous re-discoveries. ## Problem polylogue-p6rz's original list (from 2026-07-18) was stale: a lot has merged since. A fresh `devtools verify --all` run (107 failed, 14 errors on the pre-fix baseline) needed re-triage to separate fixed / persisting / newly introduced failures, and specifically to catch any real regression from this session's merges (query DSL AST schema, browser-capture approval flow, GitHub effect adapters, continuity replay wiring, etc.). ## Solution **Confirmed real regressions, fixed:** - `polylogue/config.py`: PR #3202's strict bool-env coercion rejected a blank `POLYLOGUE_FORCE_PLAIN=""` value with `ConfigError` instead of the old passthrough-as-falsy behavior, breaking a long-standing CLI test convention (and inconsistent with this same module's own NO_COLOR "blank means not requested" convention). Blank bool-key env values now resolve to `False`. - `polylogue/storage/sqlite/queries/mappers_support.py` and `polylogue/storage/blob_integrity.py`: PR #3155's three-tier JSON facade introduced `polylogue.core.json.JSONDecodeError` (a `ValueError` subclass, NOT a stdlib `json.JSONDecodeError` subclass), but two call sites still caught the stdlib type — silently losing `DatabaseError` diagnostic wrapping (field/record id context) and blob-corruption graceful degradation since 2026-07-19. **Stale test assertions / drifted mocks, fixed:** - `tests/unit/cli/test_color_and_layout.py`: tested `no_color_requested()`/ `should_use_plain()` as if they read `NO_COLOR` from the environment directly; PR #3079 made them pure passthroughs (env resolution moved to `config.py`, already covered elsewhere). Rewrote to test the passthrough contract. - `tests/unit/storage/test_durable_migrations.py`: hardcoded `USER_SCHEMA_VERSION == 9` / `applied_versions` tuple; PR #3068 bumped it to 10 without updating these two tests. - `tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr`: stale `index.db` `user_version`/`sqlite_stat1_rows` snapshot from before PR #3235's schema bump 42→43. - `tests/unit/cli/test_diagnostics.py`: `_patch_tool_count_store`'s fake `ArchiveStore.open_existing` lambda didn't accept the `read_timeout` kwarg PR #2964 added, and the fake store was missing `begin_read_snapshot()` (also from #2964's interruptible-read protocol) — 8 tests broken since 2026-07-17. - `tests/unit/devtools/test_mandate_continuity_replay.py` and `tests/unit/operations/test_work_effect_reconciliation.py`: both asserted the real `GitHubPullRequestEffectAdapter` fails against `Sinity/polylogue` — true only in an environment without `gh` auth (e.g. stock CI), false on any dev machine with `gh` authenticated for this repo (confirmed: `gh pr list --repo Sinity/polylogue` succeeds fine here). Forced deterministic unavailability via a nonexistent `gh_path` instead. - `tests/unit/storage/test_delegations_view.py`: 3 tests opened a bare `index.db`-only `ArchiveStore` (no `user.db`); PR #3068's new `archive_snapshot_epoch()` unconditionally requires `user_tier` attached. Added a sibling `user.db` bootstrap to the 3 affected fixtures — matches every other test's full-tier archive construction. - `tests/unit/architecture/test_surface_storage_boundary.py`: allow-listed two CLI commands (`reconcile_work_effects.py`, and `materialize_incident_evidence.py` — the latter landed on master via a concurrent session's PR #3336 mid-rebase) that construct `SessionRepository` directly instead of through `AppEnv.repository`, per the test's own documented remediation path. Filed polylogue-a7uk for the proper fix. **Concurrent-session note:** this branch was rebased onto master mid-flight after another session's PR #3332 landed fixing the exact same `test_timestamp_guards.py` hypothesis-6.161 mypy break I'd independently found and fixed — kept master's version (identical `st.one_of` split approach) rather than duplicating it. **Already tracked, not duplicated:** - `test_execution_control.py` `api.query_units` naming mismatch + `>=50000 VM steps` anti-vacuity mutation tests → polylogue-1ldl (fully root-caused 2026-07-20: PR #3018 made the mutation-under-test no longer expensive at this data scale). - `test_live_batch_support.py` stale `failed=[...]` assertion → polylogue-5202. - `test_archive_maintenance_cli.py` / `test_daemon_cli.py` 6-node cluster → polylogue-p5li. - `tests/infra/surfaces.py` stale `list_sessions`/`search` MCP tool-name lookups (affects `test_retrieval_readiness_laws.py`, `test_cross_surface_agreement.py`) → polylogue-t46.8 (MCP tool-sprawl replacement epic; p6rz's own original text already called this out-of-scope). **New follow-up beads filed (confirmed pre-existing, not this-session regressions, but not safe/minimal to fix inline):** - polylogue-57w4 — repair path still disagrees with converger on NULL-sort-key session-profile staleness (regresses PR #2900's own invariant; root cause not fully diagnosed). - polylogue-lbgc — seeded-archive corpus build hits `database is locked` under xdist parallel first-build (affects `test_plain_cli_snapshots.py`, `test_schema_generation.py`, likely others); confirmed not simple cross-worker contention (the build already holds an exclusive flock across the whole build+integrity-check section) — more likely an unclosed intra-process connection. - polylogue-e6a0 — `test_index_v37_fast_forward.py`'s v36 fixture predates the `action_pairs` runtime index added by PR #3210; attempted fix revealed the fixture's intended "before" shape needs the full same-version benign-DDL-convergence set, not just `ensure_runtime_indexes_sync` — reverted the attempt rather than ship an incomplete fixture. No regression found from this session's headline PRs (query DSL AST schema, browser-capture approval flow, continuity replay wiring) — the two GitHub effect-adapter tests and the `materialize_incident_evidence.py` boundary violation are environment/pattern issues in supporting test/command code, not in the new capability logic itself. ## Verification - `devtools test` on every changed test file individually: all green (see per-file evidence above). - `mypy --strict` on every changed `.py` file: clean. - `ruff format --check` / `ruff check`: clean. - Fresh `devtools verify --all` run against this branch in progress; will update this PR/polylogue-p6rz with the final authoritative count once it completes (~14 min runtime). Ref polylogue-p6rz
… stale) Problem: per-PR CI skips the heavy `test` suite (runs post-merge only), so two legitimate architecture changes from over a week ago left stale CLI test sets red without anyone noticing: - #3138 (db9447c, 2026-07-19) consolidated the `mark candidates` subcommand group into the root `judge` command (`judge --list` replaces `mark candidates list`). Several tests still invoked the deleted subcommand and got Click's "No such command 'candidates'" exit 2. - #3079 (1e60ef0, 2026-07-18) closed the 5-layer config resolution gap: `RuntimeServices`/`AppEnv` no longer resolve config from ambient environment on first touch -- composition roots must now explicitly resolve a `ResolvedRuntimeConfig`/`Config` and hand it to `AppEnv`. Several tests built a bare `AppEnv(ui=...)` (or `tests/infra/app_env.py`'s `make_app_env()`, whose docstring still described the removed ambient fallback) and hit `ConfigError("RuntimeServices has no config projection")` the first time any code path touched `env.config`/`env.polylogue`. The same architecture change also turned `should_use_plain`/ `plain_forced_by_env` into pure passthroughs of an already-resolved bool (matching the pattern `test_color_and_layout.py::TestNoColorEnv` already documents for `no_color_requested`), so two more tests that monkeypatched `POLYLOGUE_FORCE_PLAIN` and called these functions directly with no `force_plain=` argument were exercising dead code paths. What changed: - tests/unit/cli/test_json_output.py, test_json_envelope_contract.py, test_stdout_stderr_split.py: replaced `mark candidates list`/ `mark candidates --help` invocations with `judge --list` / `judge --format ...`; dropped the dead `("mark", "candidates")` help-exit parametrize case (mark is now a flat command). - tests/infra/app_env.py: `make_app_env()` now supplies an explicit, disposable `Config` via `RuntimeServices` (the "explicit library caller" path `RuntimeServices` itself documents) instead of leaving services unresolved; accepts an optional `archive_root` for callers that seed a real archive first. - tests/unit/cli/test_verb_cardinality.py: point `make_app_env` at the test's seeded `workspace_env["archive_root"]` instead of a disposable one. - tests/unit/cli/test_dashboard_command.py, test_check.py: gave their local bare-`AppEnv` constructions the same explicit-Config treatment (dashboard) or switched to the now-fixed `make_app_env()` (check); dropped now-unused `AppEnv`/`create_ui` imports in test_check.py. - tests/unit/cli/test_deterministic_output.py: `test_should_use_plain_contract` now passes `force_plain` directly instead of monkeypatching `POLYLOGUE_FORCE_PLAIN`; deleted the now-vacuous `test_should_use_plain_falsey_env_values_do_not_force_plain` (it "passed" only because the function no longer reads env at all, not because it proved anything about falsy-token parsing). - tests/unit/cli/test_check_support_runtime.py: same fix for `plain_forced_by_env`. - tests/unit/core/test_config_inventory.py: added `TestForcePlainBooleanEnvParsing` (truthy/falsy/unrecognized-token cases, mirroring `TestMCPCapabilityBooleanFailsClosed`) so `POLYLOGUE_FORCE_PLAIN` env-var parsing keeps real coverage at the layer that now owns it (`_coerce_env_value`/`_parse_bool_token`), rather than leaving a gap where the deleted CLI-layer test used to be. Verification: - devtools test tests/unit/cli/test_json_output.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_stdout_stderr_split.py -> 146 passed. - devtools test tests/unit/core/test_config_inventory.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_check_support_runtime.py tests/unit/cli/test_color_and_layout.py -> 208 passed. - devtools test tests/unit/cli/test_dashboard_command.py test_check.py test_verb_cardinality.py test_status.py test_cli_action_contracts.py test_config_command.py test_schema_drift_status.py -> 204 passed, 2 failed (test_status.py facade-route-catalog drift and test_check.py::test_check_records_scoped_maintenance_preview -- separate, still being triaged). - Not run: full tests/unit/cli/ (in progress). Ref polylogue-c66i Co-Authored-By: Claude <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds
ResolvedRuntimeConfig/resolve_runtime_config(): a single-resolution runtime-authority object that reads the environment/TOML/CLI layers exactly once, projects a legacyConfigfrom it, and fixesarchive_rootTOML precedence.Ref polylogue-9gh1, polylogue-fd2s.
Problem
archive_rootset via TOML was dead for the runtimeConfigevery real consumer (CLI, daemon, MCP) actually uses — the documented 5-layer precedence (default < site TOML < user TOML < env < CLI flag) didn't match actual runtime behavior.Solution
ResolvedRuntimeConfigresolves once and projectsConfig/DriveConfig/IndexConfig/sources from that single snapshot instead of each accessor re-reading the environment independently.polylogue.mcp.server.build_serverand the API/CLI shared surfaces now accept an optional pre-resolvedRuntimeServices/servicesrather than re-resolving per call.External provenance: recovered as
config-closure-current.difffrom a GPT Pro packet. It applied cleanly but had two real problems I found only by actually running the test suite (not from the diff itself):get_sources/get_drive_config/get_index_config/get_configfree functions, which ~20 real call sites (devtools/*.py,daemon/cli.py,demo/workspace.py, and their tests) still import directly — none of which the patch touched. Grepped every real caller (not justgit apply --check, which doesn't catch cross-file breakage) to confirm.get_index_config(runtime)/get_sources(runtime)/get_drive_config(runtime)at a later point in the same file, which — being same-named — would silently shadow the zero-arg versions at runtime (Python has no arity overloading). Resolved by keepingget_config()zero-arg (delegates toresolve_runtime_config().as_config(), since two specific call sites and their tests mock it by that exact name) while making the other three take theruntimeargument the actual test suite (tests/unit/core/test_config.py) already expected — its own docstring says the one-arg form "is the replacement."Also documented 11 newly-surfaced config keys in
docs/configuration.md(docs-coveragegate) and worked around a stale mypy 1.20.1 vs.uv.lock-pinned 2.3.0 devshell mismatch in this worktree by invoking.venv/bin/mypy/.venv/bin/ruffexplicitly.Verification
devtools test tests/unit/ -k config— 389 passed; the 4 remaining failures (test_stats_configurations×3,test_operational_web_payloads_redact_configured_archive_paths) are confirmed pre-existing/flaky by rerunning against unmodified master..venv/bin/mypy polylogue— clean, 1047 files..venv/bin/ruff check/ruff format --check— clean.devtools verify --quick— 16/16 green.tests/unit/{core,cli,mcp,demo}/sweep is noisy under this session's known xdist parallel-worker flakiness (confirmed nondeterministic: reran twice, got a different failure set each time, and master itself shows ~21 failures on the identical broad selection) — not used as the verification signal; the narrow, stable, targeted run above is.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Bug Fixes