Skip to content

refactor(embeddings): own the per-call deadline contract - #188548

Merged
vincentkoc merged 2 commits into
mainfrom
refactor/embeddings-e04-deadline-port
Oct 30, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
refactor/embeddings-e04-deadline-port

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Related: #188252

What Problem This Solves

Generic embedding execution obtains its per-call deadline contract from the memory host.

User Impact

No intended behavior change. Existing memory callers retain the same deadline channel, balanced readiness budgeting, cancellation and resource settlement.

Why This Change Was Made

Move the symbol and full report/subscribe/options contract into the existing embedding owner and private SDK facade; migrate OpenAI-compatible, Ollama and LM Studio readers together. Memory retains direct aliases and its byte-identical control factory. No new manager, package, public subpath, configuration option, authority or batch contract.

Production +9 lines; tests +53 lines. The exact 53-line allocation covers independent SDK-loader identity and strict legacy/canonical key/options compatibility; the shared scalar is unchanged.

Evidence

Fresh independent full-range review of 09c7676..69406e7 found no actionable correctness/security issues. Formatting, syntax, whitespace and normal signed commit hooks passed.

Qualified native proof at prior head a1877f0 used a private frozen install, Node 26.13.0 and explicit Node test workers:

  • SDK-loader/control suite: 5/5 passed, 8.52s command wall.
  • Five existing provider/budget suites: 81 tests passed, 53.51s command wall.
  • Full pnpm build: passed in 187.65s, including 387 declaration files, with one canonical unique symbol and memory options alias inspected. Existing private JavaScript-only facades remain unpromoted.
  • Native built SDK imports and production Jiti dist aliases all share the same symbol and preserve legacy-key notifications.
  • The required isolated LM Studio entrypoint profile qualified; Ollama loads the changed runtime lazily. This is head-only import screening, not a before/after performance claim.

The native strict consumer test correctly rejected all four invalid controls but exposed an incorrect expected diagnostic: missing subscribe is TS2741, not TS2418. Replacement 69406e7 changes only that expected integer; all production, dependency, allocation and other test inputs are byte-identical. The corrected strict consumer test passed at exact replacement head 69406e7 (1/1, 2.70s command wall); all four exact rejection controls and positive key/observer assignments remain intact. Replacement exact-head CI passed. Prior-head proof stays labeled as such and will be reused only for unchanged inputs. No live provider calls were made.

Native landing evidence: required CI run 41100228308 passed at reviewed replacement head 69406e7. Root inspected the full cutover, both fresh review reports, strict negative controls and built-output identity proof. Qualified native proof is labeled by its actual head above; no live provider or before/after performance claim.

@vincentkoc vincentkoc self-assigned this Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR moves the per-call deadline contract into the embedding contract owner while preserving memory aliases and migrating three provider readers.

Example: A managed Ollama service takes 40 seconds to become ready during a memory search.

  • Before: The provider reports readiness through the memory-owned deadline symbol.
  • After: The provider uses the embedding-owned symbol, with the memory alias preserving the same readiness-budget behavior.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused production refactor is supported by source inspection, but the new strict consumer test demonstrably fails on the reviewed head.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; no authority-bearing or persisted-data contract changes, and supplied source-loader tests do not establish built-output identity.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No user-visible behavior change is intended; generic embedding providers currently depend on memory-owned deadline contracts.
Reason: The maintainer-directed campaign supports this narrow ownership correction, which migrates all affected readers without introducing another manager or changing defaults.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this maintainer-authored PR open: the ownership refactor is coherent, but its new diagnostic assertion causes an exact-head CI failure.

Priority: P3
Reviewed head: a1877f0dd96b8aa15b1a3b801703309c6715659f

Before merge

  • Expect diagnostic 2741 for the missing subscribe member (P2) - The new consumer intentionally passes a control containing only report, but the repository compiler emits TS2741 for its missing subscribe member. This assertion expects TS2418, so the test fails despite correctly rejecting the invalid consumer. Exact-head checks-node-changed-2 confirms this mismatch. Change the expected code to 2741 while retaining the subscribe assertion.

Findings

  • [P2] Expect diagnostic 2741 for the missing subscribe member — src/plugin-sdk/plugin-runtime.types.test.ts:67

Tests

  • Missing end-to-end proof: The supplied evidence does not demonstrate built SDK symbol identity or a current-head managed cold-start search through the shipped Gateway.
Agent review details

How this fits together

Memory search supplies a per-call deadline control; embedding providers report managed-service readiness pauses through it, while cancellation remains on AbortSignal.

flowchart LR
  A[Memory search] --> B[Deadline control factory]
  B --> C[Shared embedding deadline symbol]
  C --> D[Embedding provider adapters]
  D --> E[Managed service readiness]
  E --> B
  D --> F[Embedding HTTP request]
Loading

Technical review

Best possible solution:

Retain the focused contract relocation and compatibility aliases, and correct the diagnostic assertion without weakening its missing-member check.

Do we have a high-confidence way to reproduce the issue?

This PR requests a behavior-preserving refactor rather than a runtime bug fix; its newly introduced test failure is directly established by exact-head CI.

Is this the best way to solve the issue?

The existing embedding contract owner is the appropriate home for this shared channel, and retaining aliases avoids splitting symbol identity or changing existing callers.

Full review comments:

  • [P2] Expect diagnostic 2741 for the missing subscribe member — src/plugin-sdk/plugin-runtime.types.test.ts:67
    The new consumer intentionally passes a control containing only report, but the repository compiler emits TS2741 for its missing subscribe member. This assertion expects TS2418, so the test fails despite correctly rejecting the invalid consumer. Exact-head checks-node-changed-2 confirms this mismatch. Change the expected code to 2741 while retaining the subscribe assertion.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8163a1d77101.

Provenance checked

  • Memory deadline channel and control factory keeps the original intent (874b2ce: Keep managed-service readiness on its own budget while preserving search deadlines, cancellation, and balanced overlapping waits.)
  • Ollama and LM Studio readiness reporting keeps the original intent (6dd7b2e: Bring both adapters onto the existing readiness-reporting channel so cold starts do not consume the memory-search budget.)
  • OpenAI-compatible transport call options keeps the original intent (3cfab51: Report provider token usage through existing call options while preserving preload, leases, cancellation, and deadlines.)
  • Private embedding facade and strict runtime consumer keeps the original intent (82f046e: Share the configured local-service acquisition contract while keeping process configuration host-owned and strict reconciler typing intact.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/plugin-sdk/plugin-runtime.types.test.ts --maxWorkers=1
  • pnpm test packages/memory-host-sdk/src/host/search-deadline-control.test.ts --maxWorkers=1
  • pnpm build
  • git diff --check

What I checked:

Likely related people:

  • wangmiao0668000666: Raw commit 874b2ce adds packages/memory-host-sdk/src/host/search-deadline-control.ts:40 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 874b2ce292f4; files: packages/memory-host-sdk/src/host/search-deadline-control.ts)

PR surface

Source +9, Tests +53, Other +2. Total +64 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 62 53 +9
Tests 2 54 1 +53
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 9 118 54 +64

Review metrics

Metric Value Why it matters
Production versus tests Production +62/-53; tests +54/-1 The net nine production lines relocate ownership without adding machinery; the net 53 test lines cover loader identity and strict consumer compatibility.

Root-cause cluster

Relationship: partial_overlap
Canonical: #188252
Summary: This PR implements the per-call embedding deadline ownership slice of the broader inference-contract campaign.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P3: This is behavior-preserving internal maintenance with a narrow test assertion defect and no established user-facing regression.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is behavior-preserving internal maintenance with a narrow test assertion defect and no established user-facing regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 1:26 PM ET / 17:26 UTC.

@vincentkoc
vincentkoc merged commit bcdacc9 into main Oct 30, 2026
140 of 141 checks passed
@vincentkoc
vincentkoc deleted the refactor/embeddings-e04-deadline-port branch October 30, 2026 18:12
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…8548)

* refactor(embeddings): own the per-call deadline contract

* test(embeddings): expect the missing observer diagnostic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: lmstudio extensions: ollama P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant