Skip to content

fix: make deployed Polylogue smoke trustworthy - #2303

Merged
Sinity merged 42 commits into
masterfrom
feature/fix/deployment-probe-polish
Jun 22, 2026
Merged

Sinity merged 42 commits into
masterfrom
feature/fix/deployment-probe-polish

Conversation

@Sinity

@Sinity Sinity commented Jun 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Turns live deployment probing into a concrete product/engineering slice: an installed-artifact deployment smoke command, deployed daemon/browser-capture fixes, query-action affordance contracts across CLI/HTTP/MCP/search envelopes, native ChatGPT browser-capture ingestion, repo hygiene cleanup, and durable backlog/design issues for the remaining UX and operations work.

Problem

Dogfooding against the restored ~20 GB archive showed that the deployed package could look superficially alive while core operator contracts were false or unprovable:

  • polylogued --version was missing and packaged query parsing lacked lark.
  • /api/read-view-profiles was absent in the locked deployment.
  • /api/health could trigger archive-scale readiness work.
  • Browser captures were accepted into the receiver spool without becoming queryable archive sessions.
  • The extension's DOM fallback left a much richer ChatGPT native conversation payload unused.
  • Headless browser smoke misclassified captured DOM/screenshot artifacts as failures.
  • The live archive had split-tier recovery shapes where indexed Codex sessions could lack original source-tier raw rows, causing append planning/cursor problems.
  • find QUERY then ACTION behavior lacked one durable interaction contract for target, safety, cardinality, destinations, confirmation, JSON envelopes, completions, and web/MCP affordances.
  • Repo/docs still had stale terminology and the execution plan did not reflect the new deployed-state backlog.

Solution

Runtime and deployment trust:

  • Added devtools deployment-smoke / devtools workspace deployment-smoke to probe installed versions, shell completions, daemon routes, receiver routes, browser-capture spool/raw/index materialization, receiver archive-state, and optional Chrome DOM/screenshot evidence.
  • Made polylogued --version available and fixed package/runtime dependency closure.
  • Kept /api/health bounded to DB reachability instead of archive-scale readiness.
  • Added browser-capture spool roots to default live sources and tightened browser-capture JSON snapshot handling to force full parse instead of append planning.
  • Fixed Codex append identity/cursor recovery for restored split archives.
  • Fixed deployment smoke browser PATH portability, browser artifact interpretation, SQL suffix matching, list-wrapped capture envelopes, and status/probe details.

Browser capture:

  • Documented and implemented provider-native ChatGPT capture preference over DOM fallback.
  • Raised receiver/native payload handling enough for the live ChatGPT backend payload.
  • Ensured large browser-capture JSON uses full-payload provider detection before generic large-file streaming fallback.
  • Preserved detected source names and reconciled cursor source identity from raw_sessions.origin.
  • Verified the live 47.9 MB ChatGPT capture materializes as chatgpt-export:6a2ea930-87a8-83eb-adb7-4cf38ccaa6a3 with 3,375 indexed messages.

Query-action/product contract:

  • Added docs/design/query-action-workflows.md for the find QUERY -> select/cardinality -> action -> render -> next actions workflow.
  • Extended CliActionContract into typed shared action-affordance payloads and schemas.
  • Published affordance discovery through polylogue config action-affordances, GET /api/action-affordances, MCP action_affordances, and ranked search envelopes.
  • Normalized archive-backed HTTP search envelopes and web-shell handling so result hits carry the same action-affordance surface.
  • Fixed exact-ish id: selector behavior for find id:... then select --json so no-match/hit probes are bounded instead of broad FTS timeouts.

Backlog/repo coherence:

Verification

Focused/local verification highlights:

  • devtools test tests/unit/devtools/test_deployment_smoke.py tests/unit/daemon/test_daemon_status.py tests/unit/cli/test_cli_action_contracts.py tests/unit/cli/test_completions_contract.py -> 95 passed.
  • devtools test tests/unit/cli/test_select.py tests/unit/storage/test_session_id_resolution.py tests/unit/archive/test_archive_execution_filters.py -> 14 passed.
  • devtools test tests/unit/browser_capture/test_receiver.py tests/unit/daemon/test_daemon_status.py tests/unit/sources/test_live_batch_support.py tests/unit/devtools/test_deployment_smoke.py -> 90 passed.
  • Earlier focused slices covered action-affordance CLI/daemon/MCP/search-envelope surfaces, browser-capture parsing, bounded health, web-root/browser smoke, and demo-vocabulary cleanup.
  • devtools render docs-surface --check and devtools render all --check passed for the execution-plan updates.
  • devtools verify --quick passed repeatedly locally and in pre-push, including final HEAD 111bf618e.
  • A full default devtools verify was attempted on 2a60879fb; static gates passed and pytest-testmon selected 4,334 tests, but pytest was externally SIGTERM'd after ~10 minutes at 28% with no failures reported (diagnosis=external_signal). I did not rerun that broad path after smaller follow-up commits.

Live deployed evidence through Sinnix override:

  • Current live deployment remains on runtime commit 1ec3d48 from this PR branch: polylogue, version 0.1.0+1ec3d48 and polylogued, version 0.1.0+1ec3d48.
  • polylogued.service active/running, NRestarts=0; post-catch-up observed current memory ~420 MiB, later ~1.4 GiB, peak ~2.0 GiB under the user-service limits.
  • devtools workspace deployment-smoke --json -> ok=True, failures=[].
  • devtools workspace deployment-smoke --browser --browser-executable /etc/profiles/per-user/sinity/bin/google-chrome --json -> ok=True, failures=[], nonzero DOM and screenshot bytes.
  • Latest browser-capture archive probe: ChatGPT session 6a2ea930-87a8-83eb-adb7-4cf38ccaa6a3, 3,375 turns, 3,375 indexed messages, receiver archive-state HTTP 200.
  • find id:abc then select --json exits 2 with No sessions matched. within the timeout.
  • find id:claude-code-session:971ddc00-0dea-4f67-9bac-d5756bdea57e then select --json returns the expected JSON row within the timeout.
  • Repeated Sinnix switches reset several GiB of stale zram residue, which is captured in fix(ops): prove the deployed archive is coherent after rebuild and repair #2308 as evidence for the earlier machine-pressure symptom.

GitHub checks are green except intentionally skipped release/test jobs as of the final check run before this body update; CodeRabbit was still finishing its last review pass.

Follow-up Owners

This PR deliberately does not try to finish every product feature it designed. Remaining work is tracked in durable issues:

Ref #1807
Ref #2248
Ref #2304
Ref #2305
Ref #2306
Ref #2307
Ref #2308
Ref #2309

Summary by CodeRabbit

  • New Features

    • Browser extension now captures provider-native conversation payloads (with DOM-text fallback) for supported sites.
    • Added workspace deployment-smoke to devtools and introduced a deployment smoke-test flow for probing installs.
    • Exposed an action affordances inventory via a new /api/action-affordances endpoint, plus matching CLI and MCP tooling.
    • Enhanced the web shell to surface available actions on search results.
  • Bug Fixes / Improvements

    • Updated browser-capture upload limits and shifted ChatGPT content-script start timing earlier.
  • Documentation

    • Added “Query-Action Workflows” design doc and expanded CLI/API reference for action affordances.
  • Tests

    • Added end-to-end deployment-smoke coverage and expanded action-affordance and browser-capture tests.

Sinity added 19 commits June 22, 2026 15:17
Problem: deployed probes exposed three small operator-facing defects: the Nix package omitted the query parser dependency, polylogued lacked the version option available on polylogue, and read help leaked maintainer-only PR wording.\n\nWhat changed: add lark to the Nix package closure, wire polylogued --version through the shared runtime version, and make the reserved read-view help text user-facing.\n\nVerification: devtools test tests/unit/daemon/test_daemon_cli.py::test_polylogued_version_option_reports_version tests/unit/daemon/test_daemon_cli.py::test_polylogued_help_lists_watch_command tests/unit/cli/test_exit_code_contracts.py::TestSuccessExitCode::test_read_help_exits_zero; nix build .#polylogue -o .local/result-probe-polish; POLYLOGUE_ARCHIVE_ROOT=/realm/tmp/polylogue-empty-smoke ./.local/result-probe-polish/bin/polylogue --diagnose find "repo:polylogue" --limit 1 --format json no longer fails with ModuleNotFoundError for lark.
Problem: the browser-capture receiver accepted fresh ChatGPT snapshots into the local spool, but the daemon's default watcher never observed that spool and status reported the default receiver as active in one field while inactive in another. Captured sessions could therefore appear successful at the receiver boundary without becoming archive/query rows.\n\nWhat changed: add the browser-capture spool as a default JSON live source and resolve the default receiver spool before deriving daemon browser-capture status flags. Focused tests lock the default source and status envelope contracts.\n\nVerification: devtools test tests/unit/sources/test_live_watcher.py::test_browser_capture_spool_is_default_json_source tests/unit/sources/test_live_watcher.py::test_inbox_source_accepts_zip_and_archive_formats tests/unit/daemon/test_daemon_status.py::test_daemon_status_uses_default_browser_capture_spool; ruff check polylogue/daemon/status.py polylogue/sources/live/watcher.py tests/unit/sources/test_live_watcher.py tests/unit/daemon/test_daemon_status.py
Problem: live Polylogue probing repeatedly found deployed-state skew between systemwide binaries, daemon routes, and browser-capture receiver status. Those checks were ad hoc, easy to run from the wrong PATH, and not captured by the existing branch-local dev-loop preflight.\n\nWhat changed: add devtools workspace deployment-smoke, which resolves systemwide polylogue/polylogued binaries with a sanitized PATH and probes /api/status, /api/read-view-profiles, and /v1/status. The command emits human or JSON reports and exits non-zero when required probes fail. The command catalog and generated devtools references include the new workspace command.\n\nVerification: devtools test tests/unit/devtools/test_deployment_smoke.py tests/unit/devtools/test_devtools_main.py::test_list_commands_json_includes_generated_surface tests/unit/devtools/test_devtools_main.py::test_list_commands_human_output; devtools verify --quick; devtools workspace deployment-smoke --json (expected live failure on stale deployed daemon).
Problem: live deployment probing included CLI/API/browser-capture checks, but shell-completion health still required agents to hand-assemble Click completion environment variables. That made an important query-action affordance easy to skip during deployed UX checks.\n\nWhat changed: add a completions section to the deployment smoke report for the main find-then-action workflow: then connector, action verb, read views, and view-scoped message formats. Completion failures now appear in the smoke failures list with missing candidates.\n\nVerification: devtools test tests/unit/devtools/test_deployment_smoke.py; devtools workspace deployment-smoke --json; devtools verify --quick
Problem: deployed web UI probes showed the session list route was fast while /api/facets could take more than 100 seconds, but deployment smoke did not exercise either web-shell data route. Agents had to rediscover the bottleneck manually.\n\nWhat changed: include /api/sessions?limit=1&offset=0 and /api/facets in the deployment smoke route set. Facet route failures now get a specific diagnostic and next action pointing at profiling and cached or bounded aggregation.\n\nVerification: devtools test tests/unit/devtools/test_deployment_smoke.py; devtools render all --check; devtools workspace deployment-smoke --json --timeout-s 5; devtools verify --quick
Problem: the browser-capture receiver could be active and writing JSON artifacts while the deployed archive had zero raw rows for those captures. Deployment smoke only checked the receiver route, so this spooled-only failure mode stayed invisible.\n\nWhat changed: add a browser-capture archive consistency probe to deployment smoke. It counts spooled capture JSON files under the archive root and compares them with raw_sessions rows whose source_path comes from browser-capture, reporting spooled_without_raw_rows when captured artifacts have not materialized into source.db.\n\nVerification: devtools test tests/unit/devtools/test_deployment_smoke.py; devtools workspace deployment-smoke --json --timeout-s 5; devtools verify --quick
Problem: after removing the showcase verification layer, a generic insight-transform test still used showcase-verify as its synthetic failed CI check name. That kept stale terminology showing up in repo hygiene searches even though the test was not about showcase behavior.\n\nWhat changed: rename the synthetic failed check to deployment-smoke and update the expected extracted event summary.\n\nVerification: devtools test tests/unit/insights/test_transforms.py::test_github_cli_and_failed_check_events_are_extracted; devtools verify --quick
Problem: the deployment smoke check only noticed the case where browser capture files were spooled but no raw archive rows existed. Once raw rows exist, a newer capture can still be stranded in the spool while the check reports success.

What changed: record the latest spooled capture mtime in milliseconds, compare it with the newest browser-capture raw row mtime, and report a distinct spooled_newer_than_raw_rows failure. Add focused SQLite-backed tests for empty, stale, and current browser-capture archive states.

Verification: ruff check devtools/deployment_smoke.py tests/unit/devtools/test_deployment_smoke.py; devtools test tests/unit/devtools/test_deployment_smoke.py; devtools verify --quick; devtools workspace deployment-smoke --json --timeout-s 5.
Problem: deployment smoke checked receiver liveness and local spool/raw-row consistency, but it did not verify the receiver archive-state DTO for a spooled capture. Live probing showed the deployed receiver reports captured=true with an absolute artifact_path while the current source contract uses relative artifact_ref.

What changed: derive provider/session identity from the latest spooled capture, query /v1/archive-state read-only with an extension Origin header, and report stale absolute-path or missing artifact-ref contracts as browser-capture receiver archive-state failures. Add focused tests for current and stale DTO shapes.

Verification: ruff check devtools/deployment_smoke.py tests/unit/devtools/test_deployment_smoke.py; devtools test tests/unit/devtools/test_deployment_smoke.py; devtools verify --quick; devtools workspace deployment-smoke --json --timeout-s 5.
Problem: the deployment-smoke command description still only mentioned binaries, daemon routes, and receiver liveness, even though the command now probes web routes, browser-capture raw archive materialization, and receiver archive-state contracts.

What changed: update the command catalog wording and regenerate docs/devtools.md so command discovery reflects the expanded deployed-state check.

Verification: ruff check devtools/command_catalog.py; devtools render devtools-reference; devtools render all --check; devtools verify --quick.
Problem: regenerating agent docs after the deployment-smoke catalog wording change updated the rendered command summary in AGENTS.md.

What changed: commit the generated AGENTS.md line so rendered agent guidance matches docs/devtools.md and the command catalog.

Verification: devtools render all --check; devtools verify --quick.
Problem: deployment smoke only exercised JSON API routes, so a web-shell browser failure could be confused with the daemon failing to serve the root workbench document. Live probing showed the root HTML returned quickly while browser navigation still hung on bootstrap work.\n\nWhat changed: include / in the web-route smoke set, preserve route content type and byte size, and allow successful non-JSON route bodies to be reported with a preview instead of failing JSON parsing.\n\nVerification: devtools test tests/unit/devtools/test_deployment_smoke.py; devtools verify --quick
Problem: route-level deployment smoke can prove the daemon serves the web root, but it could not reproduce the browser first-paint hang observed against the deployed workbench. That left browser-level evidence in manual notes only.\n\nWhat changed: add an opt-in --browser probe that launches headless Chrome with a temporary profile, captures DOM/screenshot byte counts, and reports structured browser-render failures without making the default smoke slower. The command catalog now shows the Nix-profile Chrome executable form used on this host.\n\nVerification: devtools test tests/unit/devtools/test_deployment_smoke.py; devtools verify --quick; devtools workspace deployment-smoke --json --timeout-s 5 --browser --browser-timeout-s 12 --browser-executable /etc/profiles/per-user/sinity/bin/google-chrome
Problem: the browser-capture docs described DOM scraping as the chosen capture strategy even though live ChatGPT probing showed the authenticated page exposes a richer provider-native conversation payload. That wording would steer future work toward a lossy fallback.\n\nWhat changed: update the architecture spine, browser-capture docs, and extension README to describe provider adapters that prefer structured app/page evidence and use DOM text only as a compatibility fallback.\n\nVerification: devtools render all --check.
Problem: restored split archives can have an indexed Codex session whose original source-tier raw row is missing, while the ingest cursor still points at an older byte offset. The append planner then cannot recover the native session id through the source-path join and falls back to full-file ingestion of very large Codex JSONL files.

What changed: when the source-tier join misses for Codex, read the first JSONL session_meta record and use its id only if index.db already contains that native codex-session. This preserves bounded append planning without inventing identity from filenames or paths.

Verification: devtools test tests/unit/sources/test_live_catchup_planning.py -q; ruff check polylogue/sources/live/batch.py tests/unit/sources/test_live_catchup_planning.py; ruff format --check polylogue/sources/live/batch.py tests/unit/sources/test_live_catchup_planning.py
Problem: deployed polylogued could spend sustained CPU in concurrent /api/health requests because the legacy health endpoint called archive readiness, which scans archive-scale tables on large restored databases. That made routine polling compete with live append ingest.

What changed: make /api/health use a read-only sqlite_master reachability probe for its quick_check field. The explicit readiness surfaces still own archive/debt/FTS diagnostics. Add a daemon HTTP contract test that fails if /api/health calls archive readiness again.

Verification: devtools test tests/unit/daemon/test_daemon_http_contracts.py -k health -q; ruff check polylogue/daemon/http.py tests/unit/daemon/test_daemon_http_contracts.py; ruff format --check polylogue/daemon/http.py tests/unit/daemon/test_daemon_http_contracts.py
Problem: deployment smoke treated browser-capture raw-row presence as enough evidence that a capture was archived. Live probing showed the latest ChatGPT capture had a source row but only a zero-message filename-derived session in index.db, so the smoke check reported green for the surface that mattered.\n\nWhat changed: extend the browser-capture archive probe to correlate the latest spooled artifact through source.db into index.db, report raw/index identity fields, and fail missing, zero-message, or native-id-mismatched materialization. Match source rows by the stable browser-capture artifact suffix so alternate active roots do not hide valid rows.\n\nVerification: devtools test tests/unit/devtools/test_deployment_smoke.py -q; ruff check devtools/deployment_smoke.py tests/unit/devtools/test_deployment_smoke.py; ruff format --check devtools/deployment_smoke.py tests/unit/devtools/test_deployment_smoke.py; python -m devtools.deployment_smoke --json --timeout-s 5 against the live archive now reports browser-capture-archive:latest_spooled_indexed_without_messages.
Problem: the live batch path decodes JSON files into a one-element payload list before dispatch. Browser-capture documents detected as ChatGPT then went through the normal ChatGPT bundle parser, producing a zero-message filename-derived placeholder instead of the provider-native captured session.\n\nWhat changed: teach provider detection and payload lowering to recognize list-wrapped browser-capture envelopes before bundle parsing, preserving the browser-capture parser path used by direct source imports.\n\nVerification: python probe against the live ChatGPT capture now parses provider_session_id=chatgpt:6a2ea930-87a8-83eb-adb7-4cf38ccaa6a3:6ab94510 with 78 messages; devtools test tests/unit/sources/test_browser_capture.py -q; ruff check polylogue/sources/dispatch.py tests/unit/sources/test_browser_capture.py; ruff format --check polylogue/sources/dispatch.py tests/unit/sources/test_browser_capture.py.
Problem: the deployment-smoke browser probe passed Chrome --timeout and --virtual-time-budget flags, which made the live Polylogue root produce no DOM or screenshot under the system Chrome even though the page could render normally without those flags. Chrome also writes artifacts but does not exit promptly on this host, so treating every timeout as failure hid useful evidence.

What changed: remove Chrome's virtual-time flags from the one-shot render probe and classify timeout-after-capture as an ok browser-render caveat when both DOM and screenshot artifacts were produced. Add regression coverage for the timeout-after-capture path and for keeping those Chrome flags out of the command.

Verification: devtools test tests/unit/devtools/test_deployment_smoke.py -q; ruff check devtools/deployment_smoke.py tests/unit/devtools/test_deployment_smoke.py; ruff format --check devtools/deployment_smoke.py tests/unit/devtools/test_deployment_smoke.py; python -m devtools.deployment_smoke --json --timeout-s 5 --browser --browser-timeout-s 12 --browser-executable /etc/profiles/per-user/sinity/bin/google-chrome.
github-actions Bot pushed a commit that referenced this pull request Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds shared action-affordance contracts and surfaces, native browser-capture ingestion, daemon/runtime state wiring, deployment-smoke tooling, query-action workflow docs/help, and a repo-wide demo rename.

Changes

Integrated query-action, capture, runtime, and docs update

Layer / File(s) Summary
Shared affordance contracts and published schemas
polylogue/surfaces/action_affordances.py, polylogue/operations/action_contracts.py, polylogue/archive/query/completions.py, devtools/render_cli_output_schemas.py, devtools/action_contract_report.py, docs/schemas/cli-output/action-affordance-list.schema.json, docs/schemas/cli-output/search-envelope.schema.json, docs/openapi/search.yaml
ActionAffordancePayload and ActionAffordanceListPayload are defined, CLI action contracts gain target/safety/command/destination fields and affordance helpers, and the published CLI/OpenAPI/schema/report artifacts are extended for the new affordance inventory.
Query-action workflow docs and CLI surfaces
docs/design/query-action-workflows.md, docs/design/README.md, README.md, docs/README.md, devtools/docs_surface.py, devtools/render_docs_surface.py, docs/cli-reference.md, browser-extension/README.md, docs/browser-capture.md, docs/architecture-spine.md, AGENTS.md, TESTING.md, docs/internals.md, docs/repo-layout.md, docs/devtools.md, tests/unit/cli/*, tests/unit/cli/__snapshots__/*
The query-action workflow design is published and indexed, CLI help and diagnostic text are updated for find --help and strict-floor wording, and related documentation tables and snapshots are regenerated.
Browser capture, live ingest, and daemon runtime
browser-extension/manifest.json, browser-extension/src/common.js, browser-extension/src/content/chatgpt.js, browser-extension/tests/common.test.js, polylogue/browser_capture/models.py, polylogue/browser_capture/server.py, polylogue/sources/parsers/browser_capture.py, polylogue/sources/dispatch.py, polylogue/sources/live/batch_support.py, polylogue/sources/live/batch.py, polylogue/sources/live/watcher.py, polylogue/daemon/status_snapshot.py, polylogue/daemon/status.py, polylogue/daemon/cli.py, polylogue/daemon/http.py, polylogue/daemon/web_shell.py, polylogue/daemon/route_contracts.py, tests/unit/browser_capture/*, tests/unit/sources/*, tests/unit/daemon/*
ChatGPT capture now prefers provider-native payloads with DOM fallback, browser-capture envelopes gain raw payload fields, live ingestion/watcher paths handle browser-capture JSON, and daemon status/HTTP/web-shell surfaces expose the new browser-capture and affordance data.
Deployment smoke tool and tests
devtools/deployment_smoke.py, devtools/command_catalog.py, flake.nix, tests/unit/devtools/test_deployment_smoke.py
A new smoke-test command probes commands, completions, routes, browser rendering, archive consistency, and receiver archive state, with command catalog wiring and coverage tests.
Demo rename and synthetic fixtures
polylogue/schemas/synthetic/demo_themes.py, polylogue/schemas/synthetic/models.py, polylogue/schemas/synthetic/build_batch.py, polylogue/schemas/synthetic/build_records.py, polylogue/schemas/synthetic/build_wire_formats.py, polylogue/schemas/synthetic/core.py, polylogue/schemas/synthetic/semantic_values.py, polylogue/schemas/synthetic/__init__.py, polylogue/demo/workspace.py, polylogue/demo/verify.py, polylogue/scenarios/corpus.py, tests/unit/core/test_synthetic_semantics.py, tests/unit/demo/test_workspace.py, tests/unit/scenarios/test_corpus.py, docs/plans/topology-target.yaml, docs/topology-status.md, tests/unit/insights/test_transforms.py
Synthetic and demo workspace helpers switch from showcase to demo terminology, default styles/prefixes change to demo, and the related docs/topology/test fixtures are updated accordingly.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related issues

Possibly related PRs

  • Sinity/polylogue#1986: Both PRs extend devtools/render_cli_output_schemas.py with additional published CLI JSON schema artifacts.
  • Sinity/polylogue#1885: Both PRs touch the find query flow and the strict-command-floor diagnostics path in polylogue/cli/query_group.py and related CLI help text.
  • Sinity/polylogue#2008: Both PRs modify devtools/action_contract_report.py and the contract-derived action documentation it renders.

Poem

🐇 I hop through contracts, crisp and new,
With demo seeds and capture glue.
Find then act, the path is bright,
Smoke tests blink through dawn and night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.54% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: make deployed Polylogue smoke trustworthy' is concise and clearly describes the main change: improving deployment smoke testing reliability and trustworthiness.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering all required template sections: Summary, Problem, Solution, Verification, Changelog consideration, and Risks/Follow-ups with clear durable issue references.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/deployment-probe-polish

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Problem: /api/status served the request-safe status snapshot, whose minimal payload hardcoded browser_capture_active=false and component_state.browser_capture=unknown while embedding a receiver payload that reported active=true. Live deployment smoke therefore saw contradictory browser-capture readiness even after the receiver and archive paths were repaired.

What changed: record daemon component enablement at startup and use that process-local state when building bounded status snapshots. The minimal snapshot now keeps browser_capture.active, browser_capture_active, component_state.browser_capture, and component_readiness.browser_capture aligned without rebuilding rich archive status in the request path.

Verification: devtools test tests/unit/daemon/test_daemon_status.py tests/unit/daemon/test_daemon_cli_remote_bind.py -q; ruff check polylogue/daemon/status_snapshot.py polylogue/daemon/cli.py tests/unit/daemon/test_daemon_status.py tests/unit/daemon/test_daemon_cli_remote_bind.py; ruff format --check polylogue/daemon/status_snapshot.py polylogue/daemon/cli.py tests/unit/daemon/test_daemon_status.py tests/unit/daemon/test_daemon_cli_remote_bind.py
Problem: the public showcase surface had been removed, but demo fixture generation still used a showcase style token, showcase file prefixes, a polylogue.schemas.synthetic.showcase module, and stale testing/docs references. The leftover names made repo hygiene checks and operator-facing docs look like the removed surface still existed.

What changed: rename the curated synthetic style to demo, move the synthetic theme module to demo_themes, update demo workspace defaults and tests to write demo-prefixed fixtures, refresh topology/generated agent docs, and remove the orphan cli-command-surface witness file that no code consumed.

Verification: devtools test tests/unit/core/test_synthetic_semantics.py tests/unit/demo/test_workspace.py tests/unit/scenarios/test_corpus.py -q; devtools render topology-projection && devtools render topology-status; devtools verify --quick; rg stale showcase/command-witness vocabulary.
Problem: the query-first CLI already exposes find QUERY then ACTION, but the product contract for cardinality, affordances, rendering, completions, browser capture fidelity, and cross-surface parity was spread across code, issues, and old design notes.

What changed: add docs/design/query-action-workflows.md as the current implementation contract for #2305, link it from the design index, and register it in the generated README/docs map surface.

Verification: devtools render all --check; devtools verify --quick.
Problem: the query-action workflow contract needs a source-level affordance DTO rather than only prose and Click command metadata. Existing ACTION_CONTRACTS powered completion, but did not carry target, safety, destinations, selection/confirmation commands, cost hints, or next actions.

What changed: extend CliActionContract with JSON-native affordance payload metadata, publish action_affordance_payloads(), include safety/destination metadata in query-action completion descriptions, and render the expanded generated CLI action-contract table.

Verification: devtools test tests/unit/cli/test_cli_action_contracts.py tests/unit/devtools/test_action_contract_report.py tests/unit/cli/test_command_aux_runtime.py::test_query_action_candidates_come_from_action_contracts_with_danger_metadata tests/unit/cli/test_completion_matrix.py::test_query_then_action_completion_per_shell tests/unit/cli/test_completion_matrix.py::test_query_action_completion_marks_destructive_actions_per_shell -q; devtools verify --quick.
github-actions Bot pushed a commit that referenced this pull request Jun 22, 2026
Problem: the deployed probe of polylogue --diagnose invalid-xyz showed the strict-floor UsageError hint being appended with a corrupted command token because the generic No such command parser split a multi-line message by punctuation.

What changed: extract quoted command names with a regex before falling back to token splitting, and cover the multi-line strict-floor message shape.

Verification: devtools test tests/unit/cli/test_diagnose_and_error_discipline.py::TestUsageErrorHints::test_actionable_hint_for_no_such_command tests/unit/cli/test_diagnose_and_error_discipline.py::TestUsageErrorHints::test_actionable_hint_for_strict_floor_message_extracts_command_only; devtools verify --quick
@Sinity

Sinity commented Jun 22, 2026

Copy link
Copy Markdown
Owner Author

2026-06-22 CLI probe follow-up

After deploying 4467066df, live probing found one more CLI papercut: polylogue find --help was fixed, but polylogue --diagnose invalid-xyz --limit 0 exposed a corrupted appended hint because actionable_hint_for_usage_error() split a multi-line strict-floor UsageError incorrectly.

Follow-up commits now on this PR:

  • 4467066df fix(cli): add focused find help
  • dac27cafa fix(cli): parse strict-floor hints robustly

Live deployed verification on 0.1.0+dac27ca:

  • polylogue find --help shows focused query workflow help.
  • polylogue --diagnose invalid-xyz --limit 0 now reports strict-floor refusal and appends a sane polylogue find invalid-xyz hint.
  • polylogued.service active/running, NRestarts=0.

Local verification:

  • devtools test tests/unit/cli/test_click_app.py tests/unit/cli/test_diagnose_and_error_discipline.py tests/unit/cli/test_help_snapshots.py tests/unit/cli/test_terminal_snapshots.py::TestHelpOutput::test_help_output_snapshot -> 94 passed.
  • devtools verify --quick -> passed locally and in pre-push on dac27cafa.

Problem: running the default seed-testmon baseline on the deployment-probe branch exposed residual gate failures: terminal help snapshots had not been refreshed for the find help line, the action-affordances config command missed the canonical -f alias, the minimal daemon status snapshot reported the actively-served API as unknown, and SQL audit line numbers drifted after user assertion helpers moved.

What changed: add the -f alias, report daemon_api as running in minimal status snapshots when no explicit API flag is configured, refresh terminal dimension snapshots, and move audited SQL interpolation entries to the current assertion reader execute lines.

Verification: devtools test tests/unit/storage/test_no_string_interpolated_sql.py::test_audited_sites_are_real_violations tests/unit/storage/test_no_string_interpolated_sql.py::test_no_unaudited_string_interpolated_sql tests/unit/cli/test_terminal_snapshots.py::TestTerminalDimensions::test_help_at_wide_width tests/unit/cli/test_terminal_snapshots.py::TestTerminalDimensions::test_help_at_narrow_width tests/unit/cli/test_theme_aliases_help_markdown.py::test_flag_aliases_consistent tests/unit/daemon/test_daemon_http_contracts.py::TestStatusEnvelopeContract::test_component_readiness_envelope_has_canonical_status_components; devtools verify --seed-testmon --skip-slow; devtools verify
@Sinity
Sinity marked this pull request as ready for review June 22, 2026 16:56
@Sinity

Sinity commented Jun 22, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Sinity

Sinity commented Jun 22, 2026

Copy link
Copy Markdown
Owner Author

2026-06-22 baseline-gate repair and final deployed probe

After taking the PR out of draft, I ran the repository baseline locally instead of relying only on quick gates. The first devtools verify --seed-testmon --skip-slow run exposed 6 failures; all are fixed in 07c2eeeb fix(test): repair deployment branch baseline gates:

  • refreshed the remaining narrow/wide terminal help snapshots for the new find --help line and strict-floor wording;
  • added the canonical -f alias to polylogue config action-affordances --format;
  • moved SQL interpolation audit entries to the current assertion reader line numbers;
  • made the minimal /api/status snapshot report daemon_api as ready/running when the API is actively serving but no explicit runtime flag is configured.

Verification after the fix:

  • Exact failed-node rerun -> 6 passed.
  • devtools verify --seed-testmon --skip-slow -> 11,624 passed, 0 failed; seed-testmon run id 20260622T164716Z-seed-testmon-3986082-c91b5737.
  • devtools verify -> passed; static gates + 7 affected pytest-testmon tests; run id 20260622T165206Z-testmon-4002263-50d991d8.
  • Pre-push devtools verify --quick -> passed on 07c2eeeb.
  • Ready-for-review GitHub checks after marking the PR non-draft: lint/typecheck/distribution/demo-visual-verify/Nix/container/security checks are green; test and release attach jobs are intentionally skipped.

Live deploy through Sinnix override is now on 0.1.0+07c2eee:

  • polylogue --version / polylogued --version both report 0.1.0+07c2eee.
  • polylogued.service active/running, NRestarts=0.
  • polylogue config action-affordances -f json emits valid JSON.
  • GET /api/status reports component_readiness.daemon_api.state=ready, scope=daemon, with component_state.api=running.

CodeRabbit review was requested after leaving draft and is currently in progress.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07c2eeeb12

ℹ️ 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".

Comment thread polylogue/sources/live/watcher.py Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
polylogue/sources/live/batch.py (1)

891-894: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve per-batch source identity instead of mutating source_name across loop iterations.

Line 936’s browser-capture branch is gated by source_name == "browser-capture", but Line 891/Line 943 mutate source_name to detected provider values. After the first file, later files in the same batch can bypass the dedicated browser-capture JSON path unintentionally.

Suggested fix
-        for path in paths:
+        watch_source_name = source_name
+        for path in paths:
+            detected_source_name = watch_source_name
             try:
                 stat = path.stat()
             except OSError:
                 failed.append(path)
                 continue
@@
             if jsonl_like:
                 provider, parse_as_session = _jsonl_provider_and_session_artifact(path, fallback_provider)
-                source_name = provider.value
+                detected_source_name = provider.value
                 if not parse_as_session:
-                    self._mark_excluded_cursor(path, stat, source_name=source_name)
+                    self._mark_excluded_cursor(path, stat, source_name=detected_source_name)
                     continue
@@
-            elif source_name == "browser-capture" and path.suffix.lower() == ".json":
+            elif watch_source_name == "browser-capture" and path.suffix.lower() == ".json":
@@
                 provider = _detect_provider_from_raw_bytes(payload, path.name, fallback_provider)
-                source_name = provider.value
+                detected_source_name = provider.value
                 if not _parse_payload_as_session_artifact(path, provider=provider, payload=payload):
-                    self._mark_excluded_cursor(path, stat, source_name=source_name)
+                    self._mark_excluded_cursor(path, stat, source_name=detected_source_name)
                     continue
@@
             elif stat.st_size >= _STREAMING_FULL_INGEST_BYTES:
                 provider = _detect_provider_from_path_sample(path, fallback_provider)
-                source_name = provider.value
+                detected_source_name = provider.value
                 if not _parse_path_as_session_artifact(path, provider=provider):
-                    self._mark_excluded_cursor(path, stat, source_name=source_name)
+                    self._mark_excluded_cursor(path, stat, source_name=detected_source_name)
                     continue
@@
             else:
@@
                 provider = _detect_provider_from_raw_bytes(payload, path.name, fallback_provider)
-                source_name = provider.value
+                detected_source_name = provider.value
                 if not _parse_payload_as_session_artifact(path, provider=provider, payload=payload):
-                    self._mark_excluded_cursor(path, stat, source_name=source_name)
+                    self._mark_excluded_cursor(path, stat, source_name=detected_source_name)
                     continue
@@
-            raw_source_names[path] = source_name
+            raw_source_names[path] = detected_source_name
@@
-                    source_name=source_name,
+                    source_name=detected_source_name,

Also applies to: 936-946, 1009-1014

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/sources/live/batch.py` around lines 891 - 894, The issue is that
source_name is being mutated at line 891 when assigned to provider.value, and
this mutation persists across loop iterations, causing the conditional check at
line 936 (if source_name == "browser-capture") to incorrectly bypass the
dedicated browser-capture JSON path for subsequent files in the same batch.
Instead of mutating source_name directly, use a separate local variable (e.g.,
detected_source_name or provider_source_name) to store provider.value and pass
that to the _mark_excluded_cursor call, while preserving the original
source_name variable for the conditional checks later in the loop.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@devtools/deployment_smoke.py`:
- Around line 397-409: The latest_relative variable is being used directly in
the latest_suffix_pattern for a SQL LIKE query without escaping special wildcard
characters. Filenames containing percent signs (%) or underscores (_) in
latest_relative will be interpreted as SQL wildcards instead of literal
characters, causing incorrect row matches. To fix this, escape the
latest_relative variable by replacing percent signs with backslash-escaped
percent signs and underscores with backslash-escaped underscores before
constructing the latest_suffix_pattern string. Additionally, add an ESCAPE '\'
clause to the WHERE condition's LIKE expression to tell SQL to treat backslash
as the escape character when evaluating the pattern.
- Around line 20-27: The SYSTEMWIDE_PATH variable contains hard-coded paths that
include the specific username sinity in the paths
/etc/profiles/per-user/sinity/bin, /home/sinity/.nix-profile/bin, and
/home/sinity/.local/bin, making the default behavior deployment and
user-specific. Remove these user-specific paths from the SYSTEMWIDE_PATH
definition or refactor the path construction to dynamically use the current
user's username instead of hard-coding sinity, so that the probe works correctly
across different deployments and users.
- Around line 488-507: The _latest_spooled_capture_summary function currently
only handles a top-level dict containing a session field, but the ingest path
now supports list-wrapped capture envelopes. After the JSON is parsed into the
raw variable, add logic to unwrap the list if raw is a list instead of a dict.
If raw is a list, extract the appropriate element (typically the last element
for a spooled capture) and use that as the actual capture envelope before
proceeding with the existing session extraction logic that checks
isinstance(raw, dict) and accesses raw.get("session").

In `@devtools/render_cli_output_schemas.py`:
- Around line 222-236: The _build_schema() function is generating an incorrect
"Generated from ..." module attribution for ActionAffordanceListPayload by
hardcoding polylogue.surfaces.payloads, when the model actually originates from
polylogue.operations.action_contracts. Update _build_schema() to derive the
module path from the model's actual __module__ attribute instead of using a
hardcoded value, ensuring the generated schema descriptions accurately reflect
where each model is defined.

In `@polylogue/daemon/status.py`:
- Around line 1707-1712: The issue is that browser_capture_active is determined
by checking effective_browser_capture_spool_path which is set to a default value
if None is passed, meaning the active flag can never be False when the intent
was to disable browser capture. To fix this, determine browser_capture_active by
checking the original browser_capture_spool_path parameter instead of the
effective_browser_capture_spool_path after the fallback. This allows passing
None to properly disable browser capture functionality that propagates to the
status checks at lines 1763 and 1832.

In `@polylogue/operations/action_contracts.py`:
- Around line 305-320: The `_validate_contracts()` function does not validate
that contract paths are non-empty, which causes issues since `action_id` is
derived from joining the path with dots. Add a validation check at the beginning
of the function (before or alongside the duplicate_paths check) to ensure each
entry in ACTION_CONTRACTS has a non-empty path, and raise a ValueError with a
descriptive message if any entry has an empty path.

In `@tests/unit/cli/test_completions_contract.py`:
- Around line 170-176: The assertion in
test_action_affordances_accepts_common_json_flags currently hard-codes the list
index assumption by checking payload["actions"][0]["id"] == "find", which
creates order-coupling and can break if actions are reordered in the future.
Instead of relying on index position, modify the assertion to search through the
actions list to find an action with id "find" (for example, using a loop or list
comprehension to assert that an action with id "find" exists in the
payload["actions"] list), making the test resilient to harmless reordering of
the actions.

In `@tests/unit/daemon/test_daemon_status.py`:
- Around line 183-200: The test
test_daemon_status_uses_default_browser_capture_spool mocks
BrowserCaptureReceiverConfig.default() with a specific spool_path value
(tmp_path / "browser-capture") but only verifies the active state and component
status, not the actual spool_path propagation. Add an assertion that verifies
the spool_path in the returned payload matches the mocked spool_path to ensure
the default configuration wiring is working correctly, not just that the
component is active.

In `@tests/unit/sources/test_live_batch_support.py`:
- Around line 412-419: The SQL query applying group_concat is non-deterministic
in SQLite versions before 3.44.0 because the ORDER BY clause is placed outside
the aggregate function rather than controlling the input order. Refactor the
query by creating an inner subquery that selects and orders the concatenated
role and text values by messages.position and blocks.position, then wrap that
subquery with an outer query that applies group_concat to the pre-ordered
results. This ensures the concatenation respects the specified order across all
supported SQLite versions.

---

Outside diff comments:
In `@polylogue/sources/live/batch.py`:
- Around line 891-894: The issue is that source_name is being mutated at line
891 when assigned to provider.value, and this mutation persists across loop
iterations, causing the conditional check at line 936 (if source_name ==
"browser-capture") to incorrectly bypass the dedicated browser-capture JSON path
for subsequent files in the same batch. Instead of mutating source_name
directly, use a separate local variable (e.g., detected_source_name or
provider_source_name) to store provider.value and pass that to the
_mark_excluded_cursor call, while preserving the original source_name variable
for the conditional checks later in the loop.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 92494d88-501d-4f58-99c5-057f626c8ec5

📥 Commits

Reviewing files that changed from the base of the PR and between 5bf20f7 and 07c2eee.

📒 Files selected for processing (95)
  • AGENTS.md
  • README.md
  • TESTING.md
  • browser-extension/README.md
  • browser-extension/manifest.json
  • browser-extension/src/common.js
  • browser-extension/src/content/chatgpt.js
  • browser-extension/tests/common.test.js
  • devtools/action_contract_report.py
  • devtools/command_catalog.py
  • devtools/deployment_smoke.py
  • devtools/docs_surface.py
  • devtools/render_cli_output_schemas.py
  • devtools/render_docs_surface.py
  • docs/README.md
  • docs/architecture-spine.md
  • docs/browser-capture.md
  • docs/cli-reference.md
  • docs/design/README.md
  • docs/design/query-action-workflows.md
  • docs/devtools.md
  • docs/internals.md
  • docs/openapi/search.yaml
  • docs/plans/topology-target.yaml
  • docs/repo-layout.md
  • docs/schemas/cli-output/README.md
  • docs/schemas/cli-output/action-affordance-list.schema.json
  • docs/schemas/cli-output/search-envelope.schema.json
  • docs/topology-status.md
  • flake.nix
  • polylogue/archive/query/completions.py
  • polylogue/browser_capture/models.py
  • polylogue/browser_capture/server.py
  • polylogue/cli/click_app.py
  • polylogue/cli/click_option_groups.py
  • polylogue/cli/commands/completions.py
  • polylogue/cli/commands/config.py
  • polylogue/cli/machine_main.py
  • polylogue/cli/parser_diagnostics.py
  • polylogue/cli/query_group.py
  • polylogue/cli/query_verbs.py
  • polylogue/daemon/cli.py
  • polylogue/daemon/http.py
  • polylogue/daemon/route_contracts.py
  • polylogue/daemon/status.py
  • polylogue/daemon/status_snapshot.py
  • polylogue/daemon/web_shell.py
  • polylogue/demo/verify.py
  • polylogue/demo/workspace.py
  • polylogue/mcp/server_tools.py
  • polylogue/operations/action_contracts.py
  • polylogue/scenarios/corpus.py
  • polylogue/schemas/synthetic/__init__.py
  • polylogue/schemas/synthetic/build_batch.py
  • polylogue/schemas/synthetic/build_records.py
  • polylogue/schemas/synthetic/build_wire_formats.py
  • polylogue/schemas/synthetic/core.py
  • polylogue/schemas/synthetic/demo_themes.py
  • polylogue/schemas/synthetic/models.py
  • polylogue/schemas/synthetic/semantic_values.py
  • polylogue/sources/dispatch.py
  • polylogue/sources/live/batch.py
  • polylogue/sources/live/batch_support.py
  • polylogue/sources/live/watcher.py
  • polylogue/sources/parsers/browser_capture.py
  • polylogue/surfaces/action_affordances.py
  • polylogue/surfaces/payloads.py
  • tests/data/witnesses/cli-command-surface.json
  • tests/unit/browser_capture/test_receiver.py
  • tests/unit/cli/__snapshots__/test_help_snapshots.ambr
  • tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr
  • tests/unit/cli/test_cli_action_contracts.py
  • tests/unit/cli/test_click_app.py
  • tests/unit/cli/test_completions_contract.py
  • tests/unit/cli/test_diagnose_and_error_discipline.py
  • tests/unit/core/test_synthetic_semantics.py
  • tests/unit/daemon/test_daemon_cli.py
  • tests/unit/daemon/test_daemon_cli_remote_bind.py
  • tests/unit/daemon/test_daemon_http_contracts.py
  • tests/unit/daemon/test_daemon_status.py
  • tests/unit/daemon/test_web_reader.py
  • tests/unit/demo/test_workspace.py
  • tests/unit/devtools/test_action_contract_report.py
  • tests/unit/devtools/test_deployment_smoke.py
  • tests/unit/insights/test_transforms.py
  • tests/unit/mcp/test_envelope_contracts.py
  • tests/unit/mcp/test_tool_contracts.py
  • tests/unit/mcp/test_tool_discovery.py
  • tests/unit/scenarios/test_corpus.py
  • tests/unit/sources/test_browser_capture.py
  • tests/unit/sources/test_live_batch_support.py
  • tests/unit/sources/test_live_catchup_planning.py
  • tests/unit/sources/test_live_watcher.py
  • tests/unit/storage/test_no_string_interpolated_sql.py
  • tests/unit/surfaces/test_search_envelope_contract.py
💤 Files with no reviewable changes (1)
  • tests/data/witnesses/cli-command-surface.json

Comment thread devtools/deployment_smoke.py Resolved
Comment thread devtools/deployment_smoke.py Resolved
Comment thread devtools/deployment_smoke.py Resolved
Comment thread devtools/render_cli_output_schemas.py Resolved
Comment thread polylogue/daemon/status.py Outdated
Comment on lines +1707 to +1712
effective_browser_capture_spool_path = (
browser_capture_spool_path
if browser_capture_spool_path is not None
else BrowserCaptureReceiverConfig.default().spool_path
)
browser_capture_active = effective_browser_capture_spool_path is not None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

browser_capture_active is now effectively hard-coded to enabled.

Line 1707 falls back to BrowserCaptureReceiverConfig.default().spool_path, and Line 1712 checks only is not None; since the default spool path is always a Path, passing browser_capture_spool_path=None can no longer represent “disabled.” This incorrectly propagates to Line 1763 and Line 1832 as running/active.

💡 Suggested fix
-    effective_browser_capture_spool_path = (
-        browser_capture_spool_path
-        if browser_capture_spool_path is not None
-        else BrowserCaptureReceiverConfig.default().spool_path
-    )
-    browser_capture_active = effective_browser_capture_spool_path is not None
+    # Preserve explicit disabled semantics: None means browser capture is off.
+    # Callers that want default-on behavior should pass the default spool path explicitly.
+    effective_browser_capture_spool_path = browser_capture_spool_path
+    browser_capture_active = browser_capture_spool_path is not None
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/daemon/status.py` around lines 1707 - 1712, The issue is that
browser_capture_active is determined by checking
effective_browser_capture_spool_path which is set to a default value if None is
passed, meaning the active flag can never be False when the intent was to
disable browser capture. To fix this, determine browser_capture_active by
checking the original browser_capture_spool_path parameter instead of the
effective_browser_capture_spool_path after the fallback. This allows passing
None to properly disable browser capture functionality that propagates to the
status checks at lines 1763 and 1832.

Comment thread tests/unit/daemon/test_daemon_status.py Resolved
Sinity added 2 commits June 22, 2026 19:17
Problem: the select and browser-read query-action paths fed raw root query terms into the execution planner, so id:abc was treated as literal FTS text. On the live archive that broadened into expensive reads and a missing ID could surface as an unexpected KeyError.

What changed: compile RootModeRequest through query_spec() before building selector filters, propagate session_id through archive execution kwargs, return empty rows/counts for missing session IDs, and replace session-id prefix LIKE scans with indexed range bounds.

Verification: devtools test tests/unit/cli/test_select.py tests/unit/storage/test_session_id_resolution.py tests/unit/archive/test_archive_execution_filters.py; devtools verify --quick; live archive probes for id:abc no-match and a real id select.
Problem: browser-capture receiver artifacts are JSON snapshots, but the live batch append planner could treat larger replacements as incomplete append tails and then mark the new tail as deferred, causing the refreshed snapshot to be skipped. Review also found a host-specific smoke PATH and weak status/test assertions.

What changed: browser-capture .json files now bypass append planning and return to the full-parse path on growth; receiver status exposes spool_path; deployment-smoke builds user paths dynamically; tests assert deterministic aggregation and status spool propagation.

Verification: devtools test tests/unit/browser_capture/test_receiver.py tests/unit/daemon/test_daemon_status.py tests/unit/sources/test_live_batch_support.py tests/unit/devtools/test_deployment_smoke.py; devtools verify --quick.
@Sinity

Sinity commented Jun 22, 2026

Copy link
Copy Markdown
Owner Author

2026-06-22 selector and review-followup probe\n\nFollow-up commits after the baseline-gate repair:\n\n- 2a60879fb fix(cli): compile id selectors for query actions\n - Root cause: find id:abc then select --json was feeding raw query terms into build_query_execution_plan(), so id:abc became literal FTS text instead of SessionQuerySpec.session_id. On the 20 GB live archive this hung/broadened instead of returning a bounded no-match.\n - Fix: selector and read --to browser now build filters from RootModeRequest.query_spec(); archive execution forwards session_id; missing IDs return empty rows/counts; session-id prefix fallback uses indexed range bounds instead of LIKE 'prefix%' scans.\n- eb27e5e96 fix(browser): force full ingest for capture snapshots\n - Addressed review findings: browser-capture .json snapshots bypass append planning and go through full parse on replacement/growth; deployment smoke PATH is user-derived; receiver status exposes spool_path; status and live-batch tests are hardened; ordered group_concat test now uses a sorted subquery.\n\nLocal verification:\n\n- devtools test tests/unit/cli/test_select.py tests/unit/storage/test_session_id_resolution.py tests/unit/archive/test_archive_execution_filters.py -> 14 passed.\n- devtools test tests/unit/browser_capture/test_receiver.py tests/unit/daemon/test_daemon_status.py tests/unit/sources/test_live_batch_support.py tests/unit/devtools/test_deployment_smoke.py -> 90 passed.\n- devtools verify --quick -> passed locally and in pre-push on eb27e5e96.\n- A full default devtools verify was attempted on 2a60879fb; static gates passed and pytest-testmon selected 4,334 tests, but the pytest step was externally SIGTERM'd after ~10 minutes at 28% with no failures reported (diagnosis external_signal). I did not repeat that broad run after the smaller review-fix commit.\n\nLive deploy through Sinnix override is now on 0.1.0+eb27e5e:\n\n- polylogue --version / polylogued --version both report 0.1.0+eb27e5e.\n- polylogue find id:abc then select --json returns exit 2 with No sessions matched. in <8s.\n- polylogue find id:<real latest session> then select --json returns the expected JSON row in <8s.\n- GET /api/status: ok=True, component_state.api=running, component_state.browser_capture=running, component_readiness.daemon_api.state=ready, browser_capture.spool_path=/home/sinity/.local/share/polylogue/browser-capture.\n- polylogued.service: active/running, NRestarts=0, current memory observed ~1.1 GiB immediately after the switch.\n\nGitHub checks for the pushed branch are green except the extension screenshot job, which was still pending at the time of this comment; CodeRabbit status is green.

Problem: the deployment smoke probe and related generated surfaces still had review-visible gaps: browser-capture suffix matching treated LIKE wildcards as pattern syntax, list-wrapped capture envelopes were ignored, schema provenance hard-coded one module, action contracts accepted empty paths, and status helpers inferred capture activity solely from a spool path.

What changed: escape LIKE suffix probes, accept list-wrapped capture envelopes, render schema provenance from the actual model module, validate action-contract path shape, add an explicit browser_capture_enabled override to the status builder, and make the JSON flag assertion order-insensitive.

Verification: devtools test tests/unit/devtools/test_deployment_smoke.py tests/unit/daemon/test_daemon_status.py tests/unit/cli/test_cli_action_contracts.py tests/unit/cli/test_completions_contract.py; devtools verify --quick
@Sinity

Sinity commented Jun 22, 2026

Copy link
Copy Markdown
Owner Author

2026-06-22 review follow-up and deployed state

Pushed 1ec3d4802 fix(devtools): close deployment probe review gaps.

Review items handled:

  • Deployment smoke browser-capture archive probe now escapes %, _, and \ before suffix LIKE matching and uses ESCAPE '\'; added a regression where cap_100%.json must not match capx100z.json.
  • Deployment smoke now accepts list-wrapped browser-capture envelopes when extracting latest spool identity.
  • CLI output schema generation now attributes generated schemas to entry.model.__module__, so action-affordance-list points at polylogue.surfaces.action_affordances.ActionAffordanceListPayload.
  • Action contract validation rejects empty paths or empty path segments.
  • Action-affordance JSON flag coverage no longer assumes find is the first returned action.
  • Browser-capture status builder now has an explicit browser_capture_enabled override. I intentionally did not adopt the suggested “None means disabled” patch because existing build_daemon_status()/daemon_status_payload() compatibility treats browser_capture_spool_path=None as “use default spool”; runtime /api/status already uses status_snapshot and reports disabled capture from configure_runtime_components(...) correctly.

Verification:

  • devtools test tests/unit/devtools/test_deployment_smoke.py tests/unit/daemon/test_daemon_status.py tests/unit/cli/test_cli_action_contracts.py tests/unit/cli/test_completions_contract.py -> 95 passed.
  • devtools verify --quick -> passed locally.
  • Pre-push devtools verify --quick -> passed on 1ec3d4802.
  • GitHub checks are green for the branch except the intentional skipped release/test jobs.

Live deploy through Sinnix override is now on 0.1.0+1ec3d48:

  • /etc/profiles/per-user/sinity/bin/polylogue --version -> polylogue, version 0.1.0+1ec3d48.
  • /etc/profiles/per-user/sinity/bin/polylogued --version -> polylogued, version 0.1.0+1ec3d48.
  • GET /api/status: ok=True; component_state={watcher: running, api: running, browser_capture: running}; browser_capture_active=True; spool path /home/sinity/.local/share/polylogue/browser-capture; browser-capture readiness ready.
  • polylogued.service: active/running, NRestarts=0, current memory observed ~1.3 GiB and peak ~1.5 GiB shortly after restart/catch-up start.
  • The Sinnix switch again reset stale zram residue (3.8 GiB -> 0B), which remains relevant evidence for the earlier machine-choking symptom.

Sinity added 2 commits June 22, 2026 19:54
Problem: live deployment probing created implementable issues for query-action UX, web responsiveness, context packs, repo polish, and deployed-state trust, but docs/execution-plan.md still pointed future agents at the older substrate-only backlog map.

What changed: add #2304-#2308 to the active backlog shape, sequence them against #2006/#1847/#1846, and add a rawlog coverage map so future work has one durable owner per theme instead of relying on chat context.

Verification: devtools render docs-surface --check; devtools render all --check
Problem: after filing #2309 for runtime/deployment configuration policy, the execution plan still assigned configurability to general polish/dev-loop buckets.

What changed: add #2309 to the active backlog table and execution order, and point the rawlog configurability row at that issue as the durable owner.

Verification: devtools render docs-surface --check; devtools render all --check
@Sinity

Sinity commented Jun 22, 2026

Copy link
Copy Markdown
Owner Author

2026-06-22 backlog alignment follow-up

Pushed two docs/backlog commits after the deployed smoke fixes:

Verification:

  • devtools render docs-surface --check -> passed.
  • devtools render all --check -> passed before each docs commit.
  • Pre-push devtools verify --quick -> passed on 96970ccb1 and again on 111bf618e.

This does not change the deployed runtime; the live system remains on the previously switched 0.1.0+1ec3d48. These commits make the backlog itself more faithful to the probing/design work.

@Sinity

Sinity commented Jun 22, 2026

Copy link
Copy Markdown
Owner Author

2026-06-22 objective audit

Current audit against the original live-probe/backlog objective:

Requirement Current evidence Status
Concrete Polylogue product/engineering backlog from live probing Open issues #2304-#2309 plus #2248/#1807; docs/execution-plan.md lists #2304-#2309 and maps the 2026-06-18 rawlog themes to durable owners. Satisfied for backlog/design ownership.
Interaction design for find QUERY then ACTION #2305 plus docs/design/query-action-workflows.md; shared affordance DTOs exposed through CLI, daemon, MCP, and search envelopes; selector bug fixed. Satisfied for design/backlog and initial executable slices; remaining implementation tracked in #2305.
Web/workbench UX failures probed and written down #2304 records route timings, facet slowness, stale/partial UI states, browser-render evidence, and acceptance criteria for degraded route states. Satisfied for backlog/evidence; implementation remains #2304.
Browser-capture deployed surface probed and repaired where narrow #2308 records receiver/spool/raw/index materialization; live smoke artifacts show latest ChatGPT capture with 3,375 turns/messages; native capture path repaired on branch and deployed during probing. Satisfied for current canonical spool path; lifecycle/import papercuts remain #2308.
Current deployed CLI/web/browser-capture surfaces tested devtools workspace deployment-smoke --json and --browser ... --json passed on the live system; /api/status currently reports watcher/api/browser_capture running and browser readiness ready. Satisfied.
Findings written down durably Issue comments on #2304/#2307/#2308/#1807 and PR #2303; execution plan updated; #2309 filed. Satisfied.
Narrow repo/package hygiene fixed in isolated worktree PR #2303 branch feature/fix/deployment-probe-polish contains package closure, stale vocabulary cleanup, deployment smoke, CLI help/selector fixes, browser smoke/probe fixes, and docs/backlog alignment. Satisfied.
Verification Focused tests passed; devtools render docs-surface --check, devtools render all --check, and repeated pre-push devtools verify --quick passed; GitHub checks are green except intentionally skipped jobs and pending CodeRabbit. Mostly satisfied; pending automated review prevents final closure claim.
PR ownership/tie-off PR body updated to current scope/evidence/follow-up owners; worktree clean and pushed. Satisfied, pending CodeRabbit final status.

Current live deployment evidence:

  • polylogue, version 0.1.0+1ec3d48
  • polylogued, version 0.1.0+1ec3d48
  • /api/status: ok=True, watcher/api/browser_capture all running, browser-capture spool /home/sinity/.local/share/polylogue/browser-capture, readiness ready.
  • /realm/tmp/polylogue-deployment-smoke-browser-1ec3d48.json: ok=True, failures=[], latest indexed session chatgpt-export:6a2ea930-87a8-83eb-adb7-4cf38ccaa6a3, 3,375 captured turns and 3,375 indexed messages, browser DOM/screenshot bytes present.

Remaining before declaring the thread fully closed: CodeRabbit is still reporting Review in progress on PR #2303 after the docs/backlog push, although no new inline comments are visible at this time.

@Sinity

Sinity commented Jun 22, 2026

Copy link
Copy Markdown
Owner Author

2026-06-22 final current smoke refresh

Before closing out the live-probe/backlog objective, I reran installed deployment smoke against the current systemwide deployment.

Current non-browser smoke:

  • Command: devtools workspace deployment-smoke --json > /realm/tmp/polylogue-deployment-smoke-current-final.json
  • Result: ok=True, failures=[].
  • Installed versions: polylogue, version 0.1.0+1ec3d48; polylogued, version 0.1.0+1ec3d48.
  • Latest browser-capture archive state is coherent: latest indexed session chatgpt-export:chatgpt:6a37f814-3dd0-83eb-a8c4-8ae7c19f422d:5953abe1, latest_capture_turn_count=8, latest_indexed_message_count=8, receiver archive-state ok=True.

Current browser-render smoke:

  • Command: devtools workspace deployment-smoke --browser --browser-executable /etc/profiles/per-user/sinity/bin/google-chrome --json > /realm/tmp/polylogue-deployment-smoke-current-browser-final.json
  • Result: ok=True, failures=[].
  • Browser render produced dom_bytes=286949 and screenshot_bytes=156731.
  • The known browser_timeout_after_capture caveat remains: Chrome does not exit promptly after artifacts are produced, but the smoke harness correctly treats captured DOM+screenshot as a successful first-paint probe.

All substantive GitHub checks are green. CodeRabbit still shows Review in progress, but there are no new visible inline comments after the docs/backlog push.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
polylogue/sources/live/batch.py (1)

936-955: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use a per-path source variable instead of mutating batch source_name.

Line 936 gates browser-capture JSON handling on source_name == "browser-capture", but source_name is reassigned in-loop (e.g., Line 943). In multi-file batches, later browser-capture .json files can miss the special path and persist incorrect source provenance at Line 1009.

💡 Proposed fix
-        fallback_provider = Provider.from_string(canonical_acquisition_provider(source_name, source_name=source_name))
+        batch_source_name = source_name
+        fallback_provider = Provider.from_string(
+            canonical_acquisition_provider(batch_source_name, source_name=batch_source_name)
+        )
@@
-        for path in paths:
+        for path in paths:
+            path_source_name = batch_source_name
@@
-            elif source_name == "browser-capture" and path.suffix.lower() == ".json":
+            elif path_source_name == "browser-capture" and path.suffix.lower() == ".json":
@@
-                source_name = provider.value
+                path_source_name = provider.value
@@
-            raw_source_names[path] = source_name
+            raw_source_names[path] = path_source_name
@@
-                    source_name=source_name,
+                    source_name=path_source_name,

Also applies to: 1009-1015

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/sources/live/batch.py` around lines 936 - 955, The issue is that
the variable source_name is being mutated inside the loop at line 943
(source_name = provider.value), which causes the condition at line 936 to fail
for subsequent browser-capture JSON files in multi-file batches. Instead of
reassigning the outer source_name variable, create a local variable to hold the
detected source name and use that local variable in the subsequent calls like
_mark_excluded_cursor and the heartbeat function, leaving the outer source_name
unchanged so that the browser-capture condition check remains valid for all
iterations in the loop.
polylogue/daemon/status.py (1)

1848-1869: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep nested browser_capture state consistent with the new override.

browser_capture_enabled is forwarded into build_daemon_status, but the nested "browser_capture" object is still generated independently from browser_capture_status_payload(...). With browser_capture_enabled=False, this can return contradictory fields in one payload (browser_capture_active=False while browser_capture.active=True).

💡 Proposed fix
 def daemon_status_payload(
@@
-    return json_document(
+    browser_capture = dict(browser_capture_status_payload(browser_capture_spool_path))
+    browser_capture["active"] = status.browser_capture_active
+    if not status.browser_capture_active:
+        browser_capture["spool_ready"] = False
+
+    return json_document(
         {
@@
-            "browser_capture": browser_capture_status_payload(browser_capture_spool_path),
+            "browser_capture": browser_capture,
@@
         }
     )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/daemon/status.py` around lines 1848 - 1869, The nested
browser_capture state is generated independently without considering the
browser_capture_enabled override parameter. Locate the call to
browser_capture_status_payload(...) in this function and pass the
browser_capture_enabled parameter to it, similar to how it's being passed to
build_daemon_status(...). This ensures the nested browser_capture object
respects the same override and maintains consistent state in the returned
payload.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@polylogue/daemon/status.py`:
- Around line 1848-1869: The nested browser_capture state is generated
independently without considering the browser_capture_enabled override
parameter. Locate the call to browser_capture_status_payload(...) in this
function and pass the browser_capture_enabled parameter to it, similar to how
it's being passed to build_daemon_status(...). This ensures the nested
browser_capture object respects the same override and maintains consistent state
in the returned payload.

In `@polylogue/sources/live/batch.py`:
- Around line 936-955: The issue is that the variable source_name is being
mutated inside the loop at line 943 (source_name = provider.value), which causes
the condition at line 936 to fail for subsequent browser-capture JSON files in
multi-file batches. Instead of reassigning the outer source_name variable,
create a local variable to hold the detected source name and use that local
variable in the subsequent calls like _mark_excluded_cursor and the heartbeat
function, leaving the outer source_name unchanged so that the browser-capture
condition check remains valid for all iterations in the loop.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f0f62f43-cd6a-4621-935b-8dc927c26525

📥 Commits

Reviewing files that changed from the base of the PR and between 07c2eee and 111bf61.

📒 Files selected for processing (23)
  • devtools/deployment_smoke.py
  • devtools/render_cli_output_schemas.py
  • docs/execution-plan.md
  • docs/schemas/cli-output/action-affordance-list.schema.json
  • polylogue/archive/query/archive_execution.py
  • polylogue/browser_capture/models.py
  • polylogue/browser_capture/receiver.py
  • polylogue/cli/read_views/standard.py
  • polylogue/cli/select.py
  • polylogue/daemon/status.py
  • polylogue/operations/action_contracts.py
  • polylogue/sources/live/batch.py
  • polylogue/storage/sqlite/archive_tiers/archive.py
  • polylogue/storage/sqlite/queries/sessions_identity.py
  • tests/unit/archive/test_archive_execution_filters.py
  • tests/unit/browser_capture/test_receiver.py
  • tests/unit/cli/test_cli_action_contracts.py
  • tests/unit/cli/test_completions_contract.py
  • tests/unit/cli/test_select.py
  • tests/unit/daemon/test_daemon_status.py
  • tests/unit/devtools/test_deployment_smoke.py
  • tests/unit/sources/test_live_batch_support.py
  • tests/unit/storage/test_session_id_resolution.py

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 71.F073 / P2: fixed-already at the checked revision: The append planner now gates on file semantics, not the watch-source name. polylogue/sources/live/batch.py:6671 returns to full ingest for .json snapshots even when a replacement is larger, so browser captures cannot be parsed as a suffix of their prior envelope.

Only the rows listed above are dispositioned. Held findings remain open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant