Skip to content

fix(daemon): mark failed rich status refreshes stale - #5621

Merged
Sinity merged 1 commit into
masterfrom
fix/csdng-status-freshness
Sep 27, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/csdng-status-freshness

Conversation

@Sinity

@Sinity Sinity commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

Failed rich daemon-status collection now reports unavailable when there is no prior rich snapshot, or stale while retaining the last coherent rich payload and its original capture time. HTTP status metadata, EvidenceValue freshness, and metrics use the same classification. A successful refresh clears the failure.

Problem

An exception from daemon_status_payload() on an unchanged archive frame replaced the rich payload with minimal failure data but still reported status_snapshot.state=fresh. The browser monitor treated that observation as connected.

Solution

Keep prior coherent evidence advisory on refresh failure, retain the failure reason, and classify each snapshot through one function shared by the HTTP and metrics projections. A neutral sequence test covers first failure, prior-good failure, and recovery.

Verification

  • devtools test tests/unit/daemon/test_daemon_status.py tests/unit/daemon/test_daemon_events_endpoint.py -k 'status_snapshot or status_etag': 16 passed, 147 deselected (receipt 20260927T101210Z-focused-test-2560209-7884f86b, tested pre-rebase commit 842a2ff84).
  • devtools verify --quick: passed (receipt 20260927T101435Z-quick-2576444-9c3ccbc1, tested pre-rebase commit 842a2ff84).
  • devtools schema closure polylogue/daemon/status_snapshot.py: out.

No full or affected suite was run. The commit was rebased onto master without conflict; the hosted candidate gate will check the final PR head.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T10:43:48.804773Z 89fd444 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 5cdb9c7f32

ℹ️ 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/daemon/status_snapshot.py Resolved
Comment thread polylogue/daemon/status_snapshot.py Resolved
@Sinity
Sinity force-pushed the fix/csdng-status-freshness branch from 5cdb9c7 to 89fd444 Compare September 27, 2026 10:41
@Sinity
Sinity merged commit 5f64a4d into master Sep 27, 2026
2 checks passed
@Sinity
Sinity deleted the fix/csdng-status-freshness branch September 27, 2026 10:51
Sinity added a commit that referenced this pull request Sep 28, 2026
- expect an unavailable snapshot when no rich observation exists (#5621);
- let the converger test double accept derivation_barrier (#5664);
- expect the request model's normalized mark payload;
- measure a steady-state chunk: the first chunk after seeding also
  prunes the seeding's raw-existence journal, one trigger per row (#5657);
- inject the thread-insight failure at the ArchiveStore the route reads.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Sinity added a commit that referenced this pull request Sep 28, 2026
## Summary

Fixes one product defect and realigns daemon and MCP tests that fail on
master because they encode superseded contracts.

## Problem

A per-directory run of `tests/unit/daemon` and `tests/unit/mcp` on clean
master (`03c543dfe`) failed 28 and 11 tests. This PR covers the clusters
below. Other failures belong to named owners or need a decision; see
Residuals.

- **Product defect: MCP hides daemon rejections.** When the resident
daemon refused a write before durable acceptance, MCP callers saw
`write: internal error (DaemonOperationRejectedError)`. The daemon's
typed code and detail were lost, for example why a saved view cannot be
watched.
- **MCP tests that write with no daemon.** Public archive writes are
daemon-owned since #5550. Nine MCP tests plus three standing-query tests
still wrote with no daemon and got `FacadeDaemonRequiredError`.
- **Stale daemon expectations:**
- Since #5621 a snapshot with no rich observation is `unavailable`, not
`stale`.
- #5664 passes `derivation_barrier` to the converger, which the test
double did not accept.
- The mark-delete route test compared against the raw payload rather
than the request model's normalized one.
- The chunk-cost test measured the first chunk after seeding. Since
#5657, that chunk also prunes the seeding's raw-existence journal, one
trigger firing per row, so its cost grew with archive size once.
- The insights failure injection patched the facade the route no longer
reads.

## Solution

- `_exception_to_error_json` relays `DaemonOperationRejectedError` with
the daemon's code and detail, as the CLI does.
- New `tests/infra/mcp.py::daemon_served_runtime_services` runs the real
operation stack on the archive's socket for MCP write tests. The
load-evidence test seeds its deliveries under the daemon and measures
reads without it.
- Each stale expectation is realigned; the chunk-cost test converges one
warm-up chunk and measures a steady-state chunk.

## Verification

`devtools test` over the affected daemon and MCP tests plus the MCP
error-translation tests: `165 passed, 1 failed` (receipt
`20260928T000820Z-focused-test-736375-35660df1`, pre-rebase). The one
failure is `test_working_dir_demand_withholds_profile_readiness`,
tracked in polylogue-6remh. The rebase kept master's own fix to
`test_convergence_debt_alert.py` and dropped this branch's change to
that file. No other conflicts.

Review follow-up (`f189af7`): `WatchDefinitionError` declares
`invalid_watch_definition`. MCP reports an undeclared (prose) rejection
code as `rejected`. `DaemonClient` keeps a pre-dispatch refusal's public
detail. `devtools test tests/unit/mcp/test_tool_error_isolation.py
…::test_skewed_write_refusal_is_pre_dispatch_not_an_indeterminate_mutation
tests/unit/daemon/test_standing_queries_default_evaluator.py` passed
(receipt `20260928T003051Z-focused-test-966381-9c978486`). `devtools
schema closure`: `archive/query/watch_definition.py` is IN, so this
lands before a rebuild.

## Residuals

- polylogue-6remh (filed): since #5570, periodic profile ticks run the
startup audit before demanded work. This starves demand and contradicts
#5540's idle-tick contract. It leaves
`test_two_accepted_revisions_survive_one_periodic_profile_pass`,
`test_working_dir_demand_withholds_profile_readiness` and likely
`test_real_factory_defers_hot_target_without_losing_the_no_hint_cursor`
red.
- Not covered here:
- master-fix-owned clusters: the read-authorizer `not authorized`
regression, `selected_session_parts` and `raw_observation_derivation`;
- daemon failures still to diagnose: schema preflight behind the #5657
frontier gate, status baseline `ok`, evidence-summary lineage authority,
stale archive storage, Drive asserted-authority growth, the watcher-hint
timeout, and status component metadata.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at 0914f89):

  • P2 polylogue/daemon/status_snapshot.py:529: Fixed on master (checked at 0914f89): refresh_error now falls back to the exception type name, and the last-good branch tests refresh_error is not None (polylogue/daemon/status_snapshot.py:530, :548).
  • P2 polylogue/daemon/status_snapshot.py:529: Fixed on master (checked at 0914f89): The status refresh collects with collecting_status_snapshot=True (polylogue/daemon/status_snapshot.py:525). The verdict then sees the retained snapshot as refreshing rather than stale, so a recovery payload does not carry the stale verdict forward (polylogue/daemon/status.py:3628-3629).

Resolving every thread listed; confirmed defects are fixed under the named bead.

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