Skip to content

fix(runtime): settle Ask claims, HTTP framing and consumer recovery - #1185

Draft
seonghobae wants to merge 3 commits into
mainfrom
fix/original-goal-reviewed-union-20261120
Draft

seonghobae wants to merge 3 commits into
mainfrom
fix/original-goal-reviewed-union-20261120

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

This branch stacks the reviewed runtime repairs on top of the compose token repair in #1184 (its head d2736e60 is the parent commit). The tree is exactly the 38-path union that received an independent substantive source review (PASS, no blocking source defect) against main 91c3e1c7.

What changes:

  • Global Ask claim generation. Claims carry the row updated_at as a lease generation. Renewal and success/failure settlement are compare-and-set on status plus generation, so a stale owner cannot overwrite a newer owner's result. On completion the worker stops scheduling renewals, drains one already in flight, and lets a lost claim win over a finished answer. External cancellation still cancels without settling as failed.
  • Optional transport timeouts. The fixed 600 s compute deadline and 570 s default socket timeout are removed. An omitted or blank ORCHESTRATOR_ANSWER_TIMEOUT_SECONDS means no LineageWeave elapsed socket limit; explicit finite positive values are kept, and an explicit null now survives the post-chat factory instead of restoring a downstream default.
  • Native HTTP framing and custody. Chunked framing wins over a conflicting Content-Length; a short declared body is rejected even when it is a complete JSON prefix. Detached responses are closed on every failure path. TLS minimum is pinned to 1.2 with certifi verification unchanged.
  • Worker recovery. Analysis-run owner lookup and post-content tail/recovery retry on asyncpg connection loss without advancing the stream cursor.
  • Consumer terminal reporting. The three lifespan consumers get a fixed-name done callback: cancellation is silent; an exception or unexpected return is logged once, type only.
  • Log privacy. Global Ask startup/round/job logs record a fixed operation and an error class only.
  • Compose and docs from fix(compose): drop the public orchestrator token default from backend and mcp #1184, plus AGENTS.md guidance on timeout classification.

Decision records

ADR 0371 (Ask claim-generation liveness), ADR 0376 (HTTP framing and response custody), ADR 0377 (background consumer terminal reporting) and the ADR 0083 null-timeout amendment are added as Proposed. Merging this PR needs those decisions; the PR is a Draft until they are made.

Verification

All on the exact tree d1a3c563, with synthetic fixtures only:

  • Full Python suite under the tests.yml conditions (Python 3.12, uv sync --frozen, postgres:16-alpine at the pinned digest): exit 0, 2,157 passed, 156 conditional skips, 0 failures. The run used this tree plus one later worker increment that is not in this branch; the 38-path tree itself was covered by targeted runs below.
  • Schema: all SQL migrations applied and the 0012+ window replayed twice on PostgreSQL 16.14, plus 24 driver-level schema tests: all passed.
  • Whole backend app (62 routes, lifespan, three consumers) on PostgreSQL 16.14 and Valkey 8.1.9 over loopback HTTP with a synthetic JWKS: authentication, scope, preference, analysis-run create/start and lineage edge persistence behaved as expected.
  • Frontend lint, test (640 cases), build and Storybook build passed on the fix(compose): drop the public orchestrator token default from backend and mcp #1184 head; this branch does not touch frontend/.

Not verified here: hosted GitHub Actions on this head, the production PostgreSQL/Valkey volumes, real provider traffic and the authenticated UI.

Known limits

  • The analysis-run worker still advances its cursor after a 409 Delivery is already running overlap; a bounded re-read is a separate change that needs its own ADR.
  • Heartbeat/reaper timing remains Proposed in ADR 0371 and has not been validated as a capacity contract.

Refs #1184

scratch and others added 3 commits November 9, 2026 16:38
… and mcp

start.py rejects the public lineageweave-orchestrator-dev-only token, but
backend and mcp still interpolated it as their fallback. Without --env-file
the orchestrator read the private token from env_file while clients sent the
public value, so every LLM channel failed authentication. Default the client
credential to empty so channels stay visibly unavailable (ADR 0045 amendment).
CodeRabbit review on #1184: a plain docker compose up without --env-file
gives only the orchestrator the token; backend and mcp need --env-file
"$HOME/.env" (make up) or a shell export.
Combine the compose token repair (#1184) with the reviewed runtime
repairs: Global Ask claim-generation fencing and completion drain,
optional finite transport timeouts that keep explicit null, complete
native HTTP framing with explicit response custody, TLS 1.2 floor,
analysis/post-content worker connection-loss retry and fixed-name
consumer terminal reporting.

ADRs 0371, 0376, 0377 and the ADR 0083 null-timeout amendment stay
Proposed. Synthetic fixtures only.

Refs #1184
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

No deployments
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