Skip to content

fix(raw-sessions): honor configured source defaults - #5632

Merged
Sinity merged 3 commits into
masterfrom
codex/p08-p09-raw-session
Sep 27, 2026
Merged

Sinity merged 3 commits into
masterfrom
codex/p08-p09-raw-session

Conversation

@Sinity

@Sinity Sinity commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Honor the configured raw-session source set when memory search and timeline requests omit origins. Keep explicit requests for unconfigured providers visible as degraded coverage gaps, and preserve an explicitly empty service source set.

Problem

Memory and timeline defaulted to the global Claude and Codex provider list. A Codex-only service therefore attempted Claude and reported a gap despite Claude not being part of that service's configuration. An empty source tuple also fell through to host defaults.

Solution

Raw memory and timeline choose defaults from their configured sources. The request contract keeps omitted origins distinguishable from explicitly requested origins, and unavailable requested providers return a degraded source row instead of raising StopIteration. P08 snapshot continuation work was removed from this PR because a per-file cursor roster exceeds the 8,192-byte token limit at the default-scale synthetic populations. Follow-up: Bead polylogue-du66c.

Verification

  • devtools test tests/unit/mcp/test_session_owner_operations.py::test_raw_memory_and_timeline_respect_explicit_source_configuration passed at eb433fb2b (receipt .cache/verify/runs/20260927T145257Z-focused-test-4159564-2c7c36f2/run.json).
  • devtools verify --quick passed at eb433fb2b (receipt .cache/verify/runs/20260927T145324Z-quick-4162359-e10c2560/run.json).
  • devtools schema closure returned out for each of the six changed source files. devtools render all --check passed with all generated surfaces synchronized.

Residuals

This change covers source ownership for raw memory and timeline only. Search continuation snapshot ownership, large-population cursor sizing, reference scope binding, legacy cursor behavior, and stat/open races are tracked in Bead polylogue-du66c.

@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-27T14:58:46.747408Z eb433fb 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: c9b95d9bd2

ℹ️ 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/operations/session_reads.py Resolved
@Sinity Sinity changed the title fix(raw-sessions): bind continuations and honor sources fix(raw-sessions): honor configured source defaults Sep 27, 2026

@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: eb433fb2be

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

@Sinity
Sinity merged commit 95c1380 into master Sep 27, 2026
2 checks passed
@Sinity
Sinity deleted the codex/p08-p09-raw-session branch September 27, 2026 15:03
Sinity added a commit that referenced this pull request Sep 27, 2026
## Summary

Fixes the tests that fail on clean master, and the two product defects
behind the biggest groups of them.

## Problem

On clean master (checked at `2da021c54`), 11 tests in the web reader,
MCP raw-session operations, thread profiles and browser capture failed,
35 in `test_privileged_tools.py` and `test_facade_mutation_census.py`, 5
in `test_session_insight_refresh.py`, and 4 more elsewhere. Two of the
causes are product defects:

- **API-owned mutations were refused through the daemon.** The daemon
labels every machine-protocol principal as surface `cli`. `user.*`
overlay operations and `mutation.facade.*` products have no CLI route,
and their actuators allow only `mcp`/`api`/`facade`. So a web-reader
saved-view save, or an annotation or saved-view delete, answered 409
`SurfaceDeniedError`. Every Python-API or MCP facade write through a
running daemon also failed; for example, `add_tag` returned "did not
complete: failed".
- **The async insight rebuild never cleared profile demand.**
`rebuild_session_insights_async` replaced profiles but left the
`session_profile_demand` row they satisfied. The profile therefore read
`stale` forever, although its binding matched. The sync twin already
acknowledges the captured revision.

The remaining failures were stale tests, each against a deliberate
change:

- The index version counter restarted at 1, so `user_version = 1` no
longer mismatches.
- Raw coverage rows follow configured source order since #5632.
- `session_events.summary` was retired in #5446.
- Markers are consumed from source-owned accepted inputs since #5493.
- #5550 deleted `_execute_facade_mutation`, which the census measured.
- `add_raw` gained `prepared_artifact`.
- The census wrapper gained a phase commit in #5550.
- Retained preparation runs in a spawned worker since #5565, so a 3 s
completion bound times out on a loaded host.
- `CliRunner.output` interleaves stderr, where `--allow-no-auth` writes
its warning.

## Solution

- `MutationPrincipal.on_surface(...)`. The user-overlay handler and the
facade product handlers now execute as the `api` surface, the public
surface that owns them, whichever transport delivered the request.
- The facade client lowers tuple arguments to JSON arrays before the
strict request models validate them. `bulk_tag_sessions` and
`post_blackboard_note` were refused before any daemon call.
- The saved-view HTTP route validates its query spec strictly, so a bad
field is a 400 with `field`, not a 409 failed operation.
- The async rebuild deletes the exact captured demand revision for each
rebuilt session. The derived-sweep census declares it and is
regenerated; the regeneration also reorders the stale `daemon_ingest.py`
entry.
- The MCP write, run and confirm-gate tests now run against the real
resident operation stack (`running_daemon_operations`). The executor
spies and failure-propagation proofs therefore observe the daemon's
executor.
- `test_facade_mutation_census.py` is deleted. Its own retirement
condition fired: the helper is gone and every facade mutation submits a
declared operation.
- Each stale test is realigned with the contract it tests; see the
commit messages.

## Verification

- `devtools test` over the 11 affected test files plus the three
`test_revision_backfill.py` ids and `test_raw_observation_owner.py`:
`707 passed` (receipt `20260927T193036Z-focused-test-1998248-bb6cdb4a`,
pre-rebase; the rebase onto `917fcaa17` applied cleanly and touched none
of these files except an unrelated appended web-reader test).
- `devtools verify --quick` passed before the last two test-only edits;
the hosted quick gate covers the pushed head.
- Derived-sweep census round-trip re-checked on the rebased tree:
identical.
- `devtools schema closure`: `mutation_transaction.py` and
`derived/session/rebuild.py` are IN, so this lands before a rebuild. The
other changed production files are OUT.

## Residuals

- The route-family declarations carry placeholder examples
(`default`/`route`) that no handler accepts, for example
`/api/import/explain` and `/api/webui/freshness` return 400. The example
replay now covers the kernel-bound routes only; `polylogue-otmpm` tracks
making the family examples real.
- A pre-reset archive (index `user_version` 67) is now classified
`upgrade_runtime`, because the counter restarted at 1. The old archive
is inert salvage and is never opened, so this was not changed.

🤖 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 64a9bd0):

  • P1 polylogue/operations/raw_sessions/sessions.py:330: Fixed on master (checked at 64a9bd0): The continuation token now carries only a snapshot handle, and the selected file population is retained in the SnapshotStore rather than embedded in the size-bounded cursor (polylogue/operations/raw_sessions/sessions.py:51-52, 593-607).

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

@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 f88b4a6):

  • P2 polylogue/operations/raw_sessions/memory.py:43: Fixed on master (checked at f88b4a6): When origins is omitted, providers named by continuation cursors are added to the requested scope, so their cursors are still decoded and validated (polylogue/operations/raw_sessions/memory.py:51-52).
  • P2 polylogue/operations/raw_sessions/sessions.py:115: Fixed on master (checked at f88b4a6): The single-source raw route now returns a degraded unavailable-source page when the requested provider is not configured, instead of calling _source() (polylogue/operations/session_reads.py:443-444).
  • P2 polylogue/operations/session_reads.py:392: Fixed on master (checked at f88b4a6): session source is unavailable, the message _path_from_reference raises for a vanished reference, is now in _SOURCE_UNAVAILABLE_MESSAGES, so the handler degrades it to a referenced session source unavailable page (polylogue/operations/session_reads.py:336, 468-474).

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