Skip to content

fix(ingest): report unconverged ingest as degraded, not completed - #5663

Merged
Sinity merged 3 commits into
masterfrom
claude/prep-ingest-outcome
Sep 27, 2026
Merged

Sinity merged 3 commits into
masterfrom
claude/prep-ingest-outcome

Conversation

@Sinity

@Sinity Sinity commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

A committed ingest whose profile/insight convergence stopped now terminates degraded rather than completed, and import --demo --wait refuses it.

Problem

Review of #5639 (import_command.py:117): IngestExecution.converge_profiles stops at the first page with an unattempted or unsuccessful target, but execute_ingest_operation finalized every ingest with outcome="completed". import --wait and every awaiting caller therefore treated an ingest whose derived readiness had not converged as done.

Solution

  • converge_profiles records profile_convergence_complete. It is true only when every page was carried through.
  • IngestTerminalSummaryHistorical gains profile_convergence_complete (nullable for receipts written before it) and a converged property.
  • ingest_terminal_outcome(history) returns degraded when either source admission or profile convergence did not finish. The executing request and the awaited read (machine_request_state) both derive the outcome from the receipt, so they agree.
  • A degraded envelope carries a retryable ingest_convergence_pending error. The rows are durable, and the daemon's convergence continues from there.
  • import --wait refuses degraded with an actionable message.
  • The Python API (parse_sources) accepts it and records converged: False in its batch observation.

Verification

  • devtools test tests/unit/operations/test_machine_receipts.py::test_ingest_terminal_outcome_is_completed_only_when_converged: passed. Its anti-vacuity condition: an unconditional completed turns both degraded rows red.
  • New tests/unit/operations/test_daemon_ingest_convergence.py: a stopped convergence records incomplete, and the later page is never attempted.
  • test_import.py: added a degraded row to test_import_demo_wait_never_verifies_an_unfinished_ingest.
  • The same tests plus test_ingest_await_result_contract.py, test_operation_audit.py and test_import.py passed in the combined focused run before the change moved to this branch.

Residuals

  • machine_receipts.py is in the schema closure, so this must land before the rebuild.
  • When import --wait gets a degraded ingest it refuses; it does not keep waiting for later convergence within its timeout.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

When profile/insight convergence stopped on a retryable target,
execute_ingest_operation still finalized outcome=completed, so
'import --demo --wait' and every awaiting caller treated an unconverged
ingest as done (#5639 review). The terminal receipt now records
profile_convergence_complete; an ingest whose rows committed but whose
source admission or convergence did not finish returns 'degraded' with a
retryable ingest_convergence_pending error, awaited reads derive the same
outcome from the receipt, and import --wait refuses it. The Python API
still accepts degraded (its rows are durable) and records converged=False.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
@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-27T20:51:24.207539Z b07086e 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: 35ecc82789

ℹ️ 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/daemon_ingest.py Resolved
Comment thread polylogue/operations/daemon_ingest.py Resolved
… and the result contract

- IngestResult admits 'degraded', bound to the receipt's recorded
  convergence, so validate_operation_result accepts the terminal payload.
- The durable machine state carries the typed ingest_convergence_pending
  error, and operation.await and a repeated request id report it.
- A repeated request id treats 'degraded' as terminal; the resume branch
  decodes the nested historical receipt rather than its wrapper.
- operation.cancel leaves a settled degraded ingest unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

@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: 106216b1b3

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

…tract-valid

- A receipt recording source_complete=False is not converged even when it
  predates profile_convergence_complete.
- Recorded admission refusals are terminal at this head: they report
  ingest_source_incomplete (retryable=False); only pending profile
  convergence reports ingest_convergence_pending (retryable=True).
- MutationResult declares the lifecycle error, so operation.await, status
  and cancel of a degraded ingest satisfy their result contract.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
@Sinity
Sinity enabled auto-merge (squash) September 27, 2026 20:54
@Sinity
Sinity merged commit f35ecb7 into master Sep 27, 2026
3 checks passed
@Sinity
Sinity deleted the claude/prep-ingest-outcome branch September 27, 2026 20:57
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