Skip to content

fix(reset): preserve bootstrap guidance for dynamic models - #119179

Merged
vincentkoc merged 1 commit into
mainfrom
fix/tools-inventory-lifecycle-20260804
Aug 5, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/tools-inventory-lifecycle-20260804

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where users starting a bare /new or /reset with pending
BOOTSTRAP.md guidance could receive no reset reply when the selected model
exposes dynamic tool metadata and its prepared runtime had not yet been
published.

Why This Change Was Made

The reset-prompt owner now resolves the request's runtime model context
asynchronously, then passes those explicit facts into the existing synchronous
effective-inventory calculation. This keeps inventory policy synchronous while
repairing the lifecycle gap at the reset boundary that owns the early lookup.

PR #119306 already landed the lifecycle-aware /tools and Gateway behavior,
including Telegram-visible proof. This rewrite deliberately drops those
overlapping changes and keeps only the remaining reset bootstrap defect.

User Impact

Bare /new and /reset flows now return the correct full or limited bootstrap
guidance for dynamic models instead of failing before any visible reply.

Evidence

  • Exact head: 89481419fac631004eaaeec7ff9f70c480321aeb
  • Exact base: 392e1c0620b53b29cf98d216ce1081b9f3df4cc3
  • Regression proof: the direct runtime-model test throws on unchanged
    production code unless request-owned modelApi and runtimeModel facts are
    supplied; it passes with this fix.
  • Focused matrix: 73 tests passed across the reset prompt, reset command,
    run-context, and effective-inventory surfaces.
  • Independent rerun of the changed tests: 12/12 passed.
  • git diff --check origin/main...HEAD: passed.
  • Targeted formatting: passed.
  • Structured autoreview: clean, correctness 0.98; TruffleHog clean.
  • Production LOC: +17/-5 (net +12); tests: +104/-1.
  • Exact-head CI: pending after the current-main rebase.
  • The remote changed-check backend was unavailable during local validation.
    Exact-head CI/Testbox remains the authoritative heavy proof.

Already-landed sibling proof:

Direct Codex contract inspection:

  • OpenClaw pins @openai/codex 0.146.0 at
    e363b08c9175ac1cbe5893615dd2cb9ddf95043b.
  • Pinned source checked:
    codex-rs/core/src/session/turn_context.rs:113-123,273-290,497-530 and
    codex-rs/core/src/session/turn.rs:184-200,251-270.
  • Current Codex drift check at
    5d89ab65dc9d4d0c55796c11df112b54157922b4:
    turn_context.rs:105-123,271-295,495-530 and
    turn.rs:195-205,294-317.
  • Both contracts keep request-owned model/tool context together for context
    construction, advertised tools, and tool calls.

No changelog entry: release-note generation owns this fix. No release, tag, or
publish action is part of this PR.

Punchcard-Session: silver-valley-valley-dt

@vincentkoc vincentkoc self-assigned this Aug 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling extensions: qa-lab size: M maintainer Maintainer-authored PR labels Aug 4, 2026
@clawsweeper clawsweeper Bot added 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. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 6:07 AM ET / 10:07 UTC.

ClawSweeper review

What this changes

The PR makes effective tool-inventory resolution asynchronous so commands, reset guidance, and Gateway requests can obtain lifecycle-owned model metadata before producing their result.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. Current main still has the synchronous lifecycle gap, and the draft replaces it coherently across its production callers; no discrete patch defect was found. Because this is a Member-owned lifecycle change, direct Codex-contract inspection and exact-head Telegram evidence should be completed before it is marked ready.

Priority: P1
Reviewed head: c1e91d18fb5c1df915cc4b49e79c4585590f1111
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is internally coherent and covered at the unit/QA-contract level, while direct Codex-contract review and an exact-head Telegram result remain outstanding.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a Member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless records only pre-fix runs and a pending exact-head Telegram rerun.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a Member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless records only pre-fix runs and a pending exact-head Telegram rerun.
Evidence reviewed 6 items Current-main failure boundary: Current main performs dynamic model resolution synchronously; if no prepared owner is published, it throws rather than returning model metadata.
PR repairs the owning lifecycle boundary: The branch catches the specific unpublished-owner error, acquires a read-only lifecycle lease, resolves the model asynchronously, and releases the lease in finally.
Caller and duplicate-lease coverage: All three production callers await the new promise; Gateway passes its resolved context as own properties, which bypasses another acquisition.
Findings None None.
Security None None.

How this fits together

Native commands and Gateway diagnostics build an effective tool inventory from session context, tool policy, and model metadata. That inventory controls the reply shown to channel operators and the capability decision used for bare session resets.

flowchart LR
  Command[Native command or Gateway request] --> Resolver[Effective inventory resolver]
  Resolver --> Lifecycle[Prepared model lifecycle]
  Lifecycle --> Model[Resolved model metadata]
  Model --> Inventory[Filtered tool inventory]
  Inventory --> Reply[Channel reply or Gateway result]
Loading

Decision needed

Question Recommendation
Can this Member-owned draft be marked ready after direct Codex lifecycle-contract inspection and an exact-head Telegram proof show that /tools compact returns the inventory rather than its fallback reply? Complete contract and live proof: Verify the relevant Codex lifecycle source and attach a redacted exact-head Telegram result before readying the draft.

Why: The source repair is coherent, but repository policy prohibits a Codex-related verdict without direct sibling-source inspection, and the current evidence does not include the promised after-fix Telegram result.

Before merge

  • Resolve merge risk (P1) - The repository requires direct sibling-Codex source inspection for Codex-related lifecycle verdicts, but that checkout was unavailable in this read-only environment.
  • Resolve merge risk (P2) - The PR body reports an exact-head Telegram rerun as pending; the linked runs describe the pre-fix timeout, not an observed post-fix reply.
  • Complete next step (P2) - A Member-owned draft already contains the concrete repair, so it should receive normal maintainer proof review rather than a parallel repair job.
Agent review details

Security

None.

PR surface

Source 0, Tests +149, Other +1. Total +150 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 5 11 11 0
Tests 7 184 35 +149
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 1 +1
Total 13 197 47 +150

Review metrics

Metric Value Why it matters
Production versus test LOC production +10/-10; tests and QA +187/-37 The production change is net-neutral while regression and diagnostic coverage carries the bulk of the diff.

Stored data model

Persistent data-model change detected: serialized state: src/auto-reply/reply/session-reset-prompt.test.ts, serialized state: src/auto-reply/reply/session-reset-prompt.ts. Confirm migration or upgrade compatibility proof before merge.

Mantis proof suggestion

A redacted Telegram transcript would directly distinguish the requested inventory reply from the fallback behavior described by the PR. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram live proof: verify that `/tools compact` returns the effective inventory in the command room and capture a redacted transcript.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Preserve the single async lifecycle-aware resolver, then obtain direct Codex contract review and an exact-head Telegram transcript showing /tools compact returns the inventory as its command reply.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Preserve the single async lifecycle-aware resolver, then obtain direct Codex contract review and an exact-head Telegram transcript showing /tools compact returns the inventory as its command reply.

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

Yes—source-reproducible: current main's synchronous model resolver throws for an unpublished lifecycle owner, and the command path catches that failure instead of producing its requested inventory. This read-only review did not execute the live Telegram flow.

Is this the best way to solve the issue?

Yes, provisionally: moving the fallback to the lifecycle-aware resolver is the narrowest owner-boundary repair, and the branch awaits every production caller without adding a compatibility path. Direct Codex contract evidence and exact-head Telegram proof remain required.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a7cca37838ac.

Labels

Label changes:

  • add P1: A native command can fail to return the requested tool inventory when its model lifecycle owner is not yet published.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a Member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless records only pre-fix runs and a pending exact-head Telegram rerun.
  • add mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The changed Telegram native-command reply is directly visible and can be demonstrated in a short recorded or transcript-based run.

Label justifications:

  • P1: A native command can fail to return the requested tool inventory when its model lifecycle owner is not yet published.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a Member-authored PR, so the external-contributor proof gate does not apply; its body nevertheless records only pre-fix runs and a pending exact-head Telegram rerun.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The changed Telegram native-command reply is directly visible and can be demonstrated in a short recorded or transcript-based run.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Current-main blame attributes the synchronous inventory and model-resolution path to this contributor, who also authored the two PR commits. (role: current feature author and recent area contributor; confidence: high; commits: 482a63337f53, c5875ed783d9, c1e91d18fb5c; files: src/agents/tools-effective-inventory.ts, src/agents/embedded-agent-runner/model.ts, src/auto-reply/reply/commands-info.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Inspect the required sibling Codex lifecycle source before making a final verdict.
  • Attach a redacted exact-head Telegram transcript or equivalent live output for /tools compact.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc
vincentkoc force-pushed the fix/tools-inventory-lifecycle-20260804 branch from c1e91d1 to 2757cf0 Compare August 5, 2026 02:19
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed gateway Gateway runtime agents Agent runtime and tooling extensions: qa-lab size: M labels Aug 5, 2026
@vincentkoc vincentkoc removed the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label Aug 5, 2026
@vincentkoc vincentkoc changed the title fix(commands): make effective inventory lifecycle-aware fix(reset): preserve bootstrap guidance for dynamic models Aug 5, 2026
Punchcard-Session: silver-valley-valley-dt
@vincentkoc
vincentkoc force-pushed the fix/tools-inventory-lifecycle-20260804 branch from 2757cf0 to 8948141 Compare August 5, 2026 02:24
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@vincentkoc
vincentkoc marked this pull request as ready for review August 5, 2026 02:28
@vincentkoc
vincentkoc merged commit 1b499e2 into main Aug 5, 2026
184 checks passed
@vincentkoc
vincentkoc deleted the fix/tools-inventory-lifecycle-20260804 branch August 5, 2026 02:45
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 5, 2026
* origin/main: (22 commits)
  refactor(plugins): consolidate lifecycle hook dispatch (#119429)
  fix(ci): stabilize TUI PTY proof ownership (#119420)
  test(system-agent): reduce suite setup overhead (#119424)
  fix(ui): keep session rail pill status from overlapping the headline (#119397)
  fix(discord): avoid doctor runtime loading (#119391)
  fix(media): decouple playback cache retention (#119417)
  fix(slack): infer upload filename extensions from MIME types (#119399)
  refactor(channels): unify configured binding resolution (#119414)
  refactor(google-meet): unify gateway and tool dispatch (#119413)
  test(state): reuse legacy database fixtures (#119423)
  fix(reset): preserve bootstrap guidance for dynamic models (#119179)
  fix(chutes): honor serving context limits (#119196)
  refactor(status): consolidate scan projections and lazy loaders (#119412)
  fix(status): status --all slows down with missing plugins (#119203)
  refactor(gateway): consolidate usage reporting and caches (#119409)
  perf(gateway): keep reload and recovery machinery off gateway cold start (#119094)
  fix(cli): align TaskFlow controller columns for wide text (#118801)
  fix: make startup migration restart guidance install-neutral (#119406)
  fix(ci): preserve cache warmer shard envelopes (#119403)
  fix(sessions): preserve compatible auth profiles on model changes (#117550)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. 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