Repository navigation
docs(localai): add module contract documentation to Local AI modules - #1896
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesAdds contract descriptions and usage examples to four Local AI modules and requires documentation headers for new modules. Example: A contributor investigates first-run Local AI setup before a managed Gateway is registered.
Review scores
ProductKind: Docs · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this maintainer-authored PR open: the prior findings are fixed, but one lifecycle example still confuses normal shutdown with explicit ownership release. Priority: P3 Before merge
Findings
Agent review detailsHow this fits togetherCompanion coordinates the native llama.cpp runtime with Gateway configuration; these modules resolve WSL ownership, execute configuration commands, and persist native Gateway ownership receipts. flowchart LR
A[Companion setup] --> B[Local AI runtime]
B --> C[Gateway lifecycle]
C --> D[Native ownership receipt]
C --> E[Gateway configuration transport]
E --> F[Native or WSL Gateway]
Technical reviewBest possible solution: Keep the focused documentation change and separate receipt-preserving shutdown from explicit runtime-owned ownership release. Do we have a high-confidence way to reproduce the issue? Source inspection establishes the documentation mismatch: normal shutdown retains the receipt, while explicit release rejects ownership whose automatic recovery remains enabled. Is this the best way to solve the issue? Existing module comments are the appropriate place for these contracts, and correcting the shutdown example requires no runtime changes or additional abstractions. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2ff4d168588d. Provenance checked
SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed November 2, 2026, 4:15 PM ET / 21:15 UTC (Revision 3). |
|
Both review findings are addressed in 8b5a429 (verified against source before editing):
Also trimmed the DistroResolver module doc and example per author feedback (63 -> 23 lines). Full build, shared (4650 passed/24 skipped/0 failed) and tray (4561 passed) suites, and docs validators all pass at the new head. Ready for re-review. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
6c21d05 to
cc111b1
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
cc111b1 to
87513dc
Compare
Describe the ownership-receipt purpose, pending/recovery semantics, and cross-process lock contract, with usage examples from LocalAiGatewayLifecycle.
- Replace garbled 'or引导' with 'or guide' - Use correct named arguments GatewayPort/ModelCatalogId/RequestedLocalAiPort - Construct GatewayRegistry from a data directory, not a settings manager
- Route decisions go through LocalAiSetupRouteResolver.ResolveAsync, which supplies observed state and the RecoveryTarget; the raw LocalAiSetupRoutePolicy.Decide flags example was unreachable. - Runtime startup goes through LlamaServerRuntimeService.EnsureStartedAsync; CompleteStartAsync/PublishAsync are runtime-owned callbacks, not a standalone start sequence. - Trim the DistroResolver module doc and example to the essentials.
Co-authored-by: Copilot App <[email protected]>
87513dc to
8188ef4
Compare
What Problem This Solves
The Local AI modules lack top-of-file documentation blocks, so contributors must reverse-engineer each module's contract, ownership, and usage from its implementation. The new AGENTS.md coding rule requires such blocks for new modules; the existing key Local AI modules did not have them yet.
User Impact
User impact: no user-visible change; developers reading or changing the Local AI modules get a module contract header with invariants and usage examples of the main public methods.
Why This Change Was Made
Adds module header documentation to four Local AI modules (
LocalAiNativeBindingStore,LocalAiGatewayConfigurationTransport,LocalAiGatewayDistroResolver,LocalAiGatewayLifecycle) documenting their contracts, invariants, and examples of their main public methods, plus an AGENTS.md coding rule requiring a top-level documentation block for new modules. All documented symbols were verified against the current API surface. Review findings were addressed: the setup route example now goes throughLocalAiSetupRouteResolver.ResolveAsync(observed state and validatedRecoveryTarget), the runtime start example goes throughLlamaServerRuntimeService.EnsureStartedAsync(the runtime invokesCompleteStartAsync/PublishAsyncas gated callbacks), and the DistroResolver doc was trimmed to essentials.Evidence
./build.ps1, all builds succeeded../scripts/validate-docs.ps1(69 Markdown files),./scripts/validate-agent-skills.ps1(13 skills, 22 Markdown files),git diff --check, all passed.Change Type
Scope
winnodeRequired proof pools
none: documentation-only change (source comments and one AGENTS.md rule line); no capacity-dependent custom Windows proof required.Validation
Ran at head
8b5a4298(docs-only change; comments in two source files):./build.ps1: all builds succeeded.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: Passed 4650, Failed 0, Skipped 24, Total 4674. Run withOPENCLAW_REPO_ROOTset to the repository root; an initial run without it failed 5-6 MXC fixture tests that resolve the TestHost image path from that variable (pre-existing environment dependency documented in AGENTS.md, unrelated to this change; with the variable set the full suite passes).dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: Passed 4561, Failed 0, Skipped 0, Total 4561../scripts/validate-docs.ps1: Documentation validation passed, 69 Markdown files checked../scripts/validate-agent-skills.ps1: Agent skill validation passed, 13 skills and 22 Markdown files checked.git diff --check: clean.Real Behavior Proof
C:\Users\pedro\devel\openclaw-windows-node.8b5a4298.Yes/No/N/A): N/ASecurity Impact
No)No)No)No)No)Yes, explain the risk and mitigation: N/ACompatibility and Migration
Yes)No)No)Review Conversations