Skip to content

refactor(update): reuse selected admission environment - #188189

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/update-selected-admission-env-20261030
Oct 30, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/update-selected-admission-env-20261030

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

The updater selects the managed service profile for database-engine selection and original-state capture, then discovers it again when admitting the run.

User Impact

Admission reuses the selected environment consistently. Recovery, state-write, foreground-claim and later native effect checks remain live. No configuration, storage schema or public API changes.

Why This Change Was Made

Carry the already selected environment through the admitted-run helper to the ledger owner and require it at that boundary. Remove the second discovery and its discovery-only arguments. No fallback resolver or parallel context object is added. Production net: one line, including the ownership comment; tests cover the shared selected-profile invariant.

Evidence

Exact-head CI (0d514447a143d10a8384bc4297e5a58cac4f9093) shows 55 passing cases across five changed files: service ownership (19), mutable signals (18), contention (8), admission schema (3), and task delivery (7). See ownership/signals/contention, schema, and task delivery.

The new real updateCommand owned-command case passed in 9556 ms. Distinct caller/service configurations exercise the real engine, native-command reader, recovery capture, admission and ledger. Assertions prove one environment discovery, shared selected environment, captured database bytes predating the new admission row, and terminal publication only in the service database. An unsupported package target bounds execution before download, install or service mutation. Existing foreground-claim expiry tests remain unchanged; all direct callers, including child scripts, pass explicit environments.

Local autoreview and a separate source review found no actionable P0–P3 defect. Targeted oxfmt, git diff --check and normal signed-commit hooks passed. The selected Testbox route queued during related proof, so execution used PR CI; this editor has no dependency install. Individual execution counts were not inspected for update-command-run.test.ts, update-dry-run-state.process.test.ts, or src/daemon/service.test.ts; no specific count is claimed for those files. No live operator service or state was changed.

@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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: S labels Oct 30, 2026
@vincentkoc vincentkoc self-assigned this Oct 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 30, 2026 08:35
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR passes the updater’s selected environment into run admission instead of discovering the service profile again.

Example: The caller profile uses channel stable while the managed service profile uses channel beta.

  • Before: Engine selection and original-state capture select the service profile, then admission repeats profile discovery.
  • After: Admission uses the same selected service environment and records the outcome in its database.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A coherent, narrowly scoped refactor with passing exact-head gates and meaningful persistence assertions; supplied behavioral coverage remains in process.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied coverage runs updateCommand with real engine, recovery-capture, and ledger owners against mocked native service I/O, and source inspection confirms unchanged persisted formats with no migration required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Update preparation and admission unnecessarily rediscover the managed service profile instead of sharing the selected environment.
Reason: The maintainer-authored direction removes duplicate discovery within the existing owner and preserves configuration, storage, and public contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a focused simplification that preserves admission safeguards, remains absent from current main, and has passing exact-head gates; no actionable defect was found.

Priority: P3
Reviewed head: 0d514447a143d10a8384bc4297e5a58cac4f9093

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied test does not establish an installed-CLI upgrade run or a demonstrated base-failing/head-passing comparison.
Agent review details

How this fits together

CLI update orchestration selects an installation and service environment, prepares database access and recovery capture, and admits a run into the existing update ledger before guarded execution.

flowchart TD
  A[Update CLI] --> B[Select service environment]
  B --> C[Select database engine]
  C --> D[Capture original state]
  D --> E[Admit run with selected environment]
  E --> F[Existing update ledger]
  E --> G[Guarded update execution]
Loading

Technical review

Best possible solution:

Use the existing selected environment throughout preparation and admission while retaining live recovery, ownership, and effect checks.

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

Source establishes duplicate environment discovery in the base and current main; no live user failure was reproduced or claimed.

Is this the best way to solve the issue?

The patch is the smallest complete change: thread the existing environment through the current helper, require it at admission, and migrate callers without adding state or a fallback path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5f6f15fed0d6.

Provenance checked

  • Selected-profile preparation keeps the original intent (212f041: Selected-target initialization must precede history creation while preserving owned service selectors and existing-state compatibility.)
  • Admitted orchestration keeps the original intent (1794d8b: The helper was extracted without changing orchestration, while service capture and writes remained owned by the selected profile; its commit message and extraction patch were retrieved through REST after a local old-blob lookup failed.)
  • Recovery admission and ledger options keeps the original intent (000af98: Pending recovery must refuse before writable state opens; subsequent SQLite-wait preservation remains intact because the patch retains the existing ledger-options construction.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 1794d8b adds src/cli/update-cli/update-command-admitted.ts:92 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1794d8b4ef8d; files: src/cli/update-cli/update-command-admitted.ts)
  • Vincent Koc: Raw commit 931de9e adds src/cli/update-cli/update-command-admitted.ts:123 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 931de9e55a35; files: src/cli/update-cli/update-command-admitted.ts)

PR surface

Source +1, Tests +100. Total +101 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 6 5 +1
Tests 8 125 25 +100
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 131 30 +101

Review metrics

Metric Value Why it matters
Production versus test LOC Production +6/-5; tests +125/-25 Production growth is one ownership comment; test growth extends an existing fixture to check selected-profile persistence and original-state capture.

Labels

Label changes:

  • add P3: This is a focused internal simplification without an established user-facing failure or urgent regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a focused internal simplification without an established user-facing failure or urgent regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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, 5:02 AM ET / 09:02 UTC.

@vincentkoc
vincentkoc merged commit ff79e33 into main Oct 30, 2026
218 checks passed
@vincentkoc
vincentkoc deleted the refactor/update-selected-admission-env-20261030 branch October 30, 2026 09:11
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant