Skip to content

fix(tooling): diagnose declaration escapes into ancestor installs - #139766

Merged
steipete merged 2 commits into
mainfrom
steipete/declaration-boundary-diagnosis
Sep 6, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/declaration-boundary-diagnosis

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where maintainers running the declaration package-boundary lane in a nested checkout were told to install a dependency that was already correctly installed. The failure came from resolution reaching the parent checkout's install, so following the old advice could not repair it.

Why This Change Was Made

The diagnostic now identifies the ancestor node_modules that supplied the escaped input and explains how to avoid it: run in a checkout outside another install, or repair the ancestor install to the repository's nodeLinker: isolated layout in pnpm-workspace.yaml. The existing guard, rejection conditions, and message prefix remain unchanged; unrelated escapes retain the original advice, and both branches identify undeclared imports as the boundary violation to investigate when nesting is absent.

User Impact

Maintainers get an actionable explanation of the actual install topology instead of being sent back to reinstall a package that is already present. This only changes failure diagnostics; contaminated declaration inputs still fail and cannot be accepted.

Evidence

Before (local paths anonymized):

Declaration input escapes checkout: /workspace/openclaw/node_modules/punycode/package.json -> /workspace/openclaw/node_modules/punycode/package.json. Install declaration dependencies inside /workspace/openclaw/worktrees/validation; shared installs and external symlinks are unsupported.

After (local paths anonymized):

Declaration input escapes checkout: /workspace/openclaw/node_modules/punycode/package.json -> /workspace/openclaw/node_modules/punycode/package.json. This checkout is nested inside another install at /workspace/openclaw/node_modules; module resolution walked out of the checkout and read a package from it. Run this lane in a checkout that is not nested inside another node_modules, or repair that ancestor install to the repository's isolated layout (nodeLinker: isolated in pnpm-workspace.yaml), which keeps transitive packages out of its root rather than exposing them to nested checkouts. If the checkout is not nested inside another install, the compiled package imported a dependency it does not declare, which is the boundary violation this check exists to catch.

Both live runs used node --import ./scripts/tsx.mjs scripts/prepare-extension-package-boundary-artifacts.mts and exited 1 on the same ancestor punycode/package.json, as required.

The four requested suites passed: 59 tests passed, 8 platform-specific tests skipped. The two new message assertions first failed against the original implementation. oxfmt on both touched files and git diff --check passed.

pnpm install --frozen-lockfile and pnpm check:changed passed in an independent checkout outside the parent repository, using isolated OPENCLAW_STATE_DIR and OPENCLAW_CONFIG_PATH. The copied patch was verified byte-for-byte against the candidate.

Codex autoreview of the local candidate and committed branch returned scoped-clean with no accepted/actionable findings at the helper's default P0 threshold.

Also fixes red main

While this PR was in review, main went red on check-test-types-core-2:

src/gateway/session-history-state.test.ts(398,9): error TS2353:
Object literal may only specify known properties, and
'streamErrorFallbackPending' does not exist in type 'ChatDisplayProjectionResult'.

#139753 renamed that projection result's streamErrorFallbackPending and streamErrorFallbackRepaired to assistantErrorPending and assistantErrorRecoveryObserved, but one call site in src/gateway/session-history-state.test.ts kept the old names. They were the only two stale references left in the repository. That PR's targeted CI plan never selected this shard, so the break first surfaced on a full main run rather than on the PR.

Repo policy is to fix a red main in the landing PR rather than wait it out, so the rename is applied here as a separate commit. No fix was open for it. Verified: the owning shard typechecks (exit 0), src/gateway/session-history-state.test.ts passes, and no reference to either old name remains.

@clawsweeper

clawsweeper Bot commented Sep 6, 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.

@steipete
steipete marked this pull request as ready for review September 6, 2026 05:02
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 6, 2026, 1:45 AM ET / 05:45 UTC.

ClawSweeper review

What this changes

The PR explains declaration-build failures caused by ancestor dependency installations, tests both diagnostic branches, and updates a Gateway test fixture to use current projection fields.

Merge readiness

⛔ Blocked before merge - 1 item remains

The PR remains useful and has no actionable findings. The earlier migration-proof blocker was a false positive: no persisted data model changes. The supplied before/after output adequately proves the diagnostic improvement.

Priority: P3
Reviewed head: e3f0921d165376602f4572706f576198970c3d34

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct diagnostic improvement with directly relevant live proof and no remaining actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied before/after terminal output exercises the declaration artifact preparation entrypoint in a real nested checkout: the same ancestor package remains rejected with exit 1, and the changed boundary now identifies its installation and corrective guidance.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied before/after terminal output exercises the declaration artifact preparation entrypoint in a real nested checkout: the same ancestor package remains rejected with exit 1, and the changed boundary now identifies its installation and corrective guidance.
Evidence reviewed 8 items Introduced changes preserve rejection: The complete pinned base-to-head diff changes diagnostic selection only inside the existing rejection branch. Path normalization, containment predicates, compiler hooks, and acceptance behavior remain unchanged; the other production-adjacent change is a test fixture field rename.
Live diagnostic proof: The supplied complete PR body records before/after output from the declaration artifact preparation entrypoint in a nested checkout. Both runs rejected the same ancestor punycode/package.json with exit 1, while the after-fix output identified the ancestor installation and recovery guidance. The captured context sourceRevision is ad8960bbb448f660b3b160da3022188d206f9deb417060b9c862170c3e3e80b8. Reported supplemental validation includes regression assertions failing before the fix, focused suites, and check:changed in an independent checkout; these were not rerun during this read-only review.
Previous compatibility concern resolved: The author's explanation at #139766 (comment) agrees with the inspected diff: the word 'repair' appears in operator guidance, not a migration. No schema, persisted format, storage semantics, or plugin API changes are introduced. The earlier reviewed SHA was unavailable locally, so no byte-for-byte continuity claim is made.
Findings None None.
Security None None.

How this fits together

OpenClaw's declaration tooling checks compiler inputs before accepting generated type declarations. Inputs outside the checkout are rejected; this change gives operators more specific guidance about the installation that supplied them.

flowchart TD
  A[Declaration build] --> B[Resolved compiler input]
  B --> C{Inside checkout?}
  C -->|Yes| D[Continue existing build flow]
  C -->|No| E{Ancestor dependency install?}
  E -->|Yes| F[Reject with installation guidance]
  E -->|No| G[Reject with external dependency guidance]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Tests +23, Other +20. Total +43 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 25 2 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 21 1 +20
Total 3 46 3 +43

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: scripts/lib/tsdown-declaration-boundary.mts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep declaration inputs confined to the checkout while explaining ancestor-install contamination at the existing rejection boundary.

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

Yes: pinned main gives generic reinstall advice when a declaration input resolves into an ancestor installation, and the supplied live transcript demonstrates that trigger. This review verified the source path without executing target code.

Is this the best way to solve the issue?

Yes: diagnosis belongs in the existing shared rejection boundary, and the patch preserves its acceptance rules while using the repository's documented installation layout.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This improves a developer-facing failure diagnostic and corrects a test fixture without changing runtime behavior or declaration acceptance.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied before/after terminal output exercises the declaration artifact preparation entrypoint in a real nested checkout: the same ancestor package remains rejected with exit 1, and the changed boundary now identifies its installation and corrective guidance.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied before/after terminal output exercises the declaration artifact preparation entrypoint in a real nested checkout: the same ancestor package remains rejected with exit 1, and the changed boundary now identifies its installation and corrective guidance.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-06T05:09:39.889Z sha 3c552bf8c85d8a7a8c5720a528f9a7ca670436cc :: blocked before merge. :: none

@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Addressing the one Before merge item — Add data-model compatibility proof — with a stated skip rather than a proof, because there is no data model here to be compatible with.

The finding cites Persistent data-model change detected: migration/backfill/repair: scripts/lib/tsdown-declaration-boundary.mts. That classification is a false positive, and the trigger is visible in the diff: this change adds the word "repair" to a diagnostic string (or repair that ancestor install to the repository's isolated layout), which matches the migration/backfill/repair keyword rule.

Evidence that nothing persistent changed:

  • The complete diff is two files, +44/-1: scripts/lib/tsdown-declaration-boundary.mts and test/scripts/native-declaration-boundary.test.ts.
  • No migration, schema, SQLite, store, or persistence file is touched. git diff --name-only origin/main...HEAD matched against migration|schema|sqlite|store|persist|\.sql$ returns nothing.
  • The changed module is repository build tooling. It has no persisted state at all: it patches the TypeScript compiler's in-memory sys for the duration of a declaration build and throws on inputs outside the checkout. The only behavioral surface it owns is an Error message.
  • This change alters diagnosis only. The guard throws under exactly the same conditions as before; both new tests assert message text, and both fail against the pre-change implementation.

I am deliberately not rewording the message to avoid the keyword. The word "repair" is the correct operator instruction here, and editing code to satisfy a classifier would be the wrong fix.

Everything else in the review was clean: no findings, no security issues, no rank-up moves.

@steipete
steipete force-pushed the steipete/declaration-boundary-diagnosis branch from 3c552bf to ec81849 Compare September 6, 2026 05:25
#139753 renamed the projection result's streamErrorFallbackPending and
streamErrorFallbackRepaired to assistantErrorPending and
assistantErrorRecoveryObserved, but one call site in this test kept the old
names, leaving main red on check-test-types-core-2. Its targeted PR CI never
selected this shard, so the break first appeared on a full main run.
@steipete
steipete force-pushed the steipete/declaration-boundary-diagnosis branch from ec81849 to e3f0921 Compare September 6, 2026 05:40
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 6, 2026
@steipete
steipete merged commit 2bc4699 into main Sep 6, 2026
145 checks passed
@steipete
steipete deleted the steipete/declaration-boundary-diagnosis branch September 6, 2026 05:55
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 7, 2026
Explain ancestor manifest probes despite a complete local install and checkout-local final resolution. Direct validation to a physically isolated checkout without changing input membership or fail-closed containment. Add native regression coverage for manifest-only probes, standalone receipt reuse, and consumed-manifest invalidation.

Related: #139766
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…enclaw#139766)

* fix(tooling): diagnose declaration escapes into ancestor installs

* fix(gateway): use current projection fields in session history test

openclaw#139753 renamed the projection result's streamErrorFallbackPending and
streamErrorFallbackRepaired to assistantErrorPending and
assistantErrorRecoveryObserved, but one call site in this test kept the old
names, leaving main red on check-test-types-core-2. Its targeted PR CI never
selected this shard, so the break first appeared on a full main run.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…w#140617)

Explain ancestor manifest probes despite a complete local install and checkout-local final resolution. Direct validation to a physically isolated checkout without changing input membership or fail-closed containment. Add native regression coverage for manifest-only probes, standalone receipt reuse, and consumed-manifest invalidation.

Related: openclaw#139766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XS 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