openclaw - ✅(Solved) Fix [Bug]: tsgo pre-commit hook fails on main — 4 pre-existing type errors block local commits [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62014Fetched 2026-04-08 03:10:19
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×2

The pre-commit hook runs pnpm check, which includes tsgo. On current main (as of 2026-04-06), tsgo reports 4 type errors in files unrelated to any staged changes, blocking all local commits without --no-verify.

Error Message

src/gateway/client.ts(237,13): error TS2322 src/hooks/bundled/session-memory/transcript.ts(6,58): error TS2339 src/plugins/hooks.sync-only.test.ts(20,5): error TS2322 src/plugins/hooks.sync-only.test.ts(21,5): error TS2322

Root Cause

The pre-commit hook runs pnpm check, which includes tsgo. On current main (as of 2026-04-06), tsgo reports 4 type errors in files unrelated to any staged changes, blocking all local commits without --no-verify.

Fix Action

Fixed

PR fix notes

PR #62013: fix(config): suggest .config nesting for misplaced plugin entry keys

Description (problem / solution / changelog)

Plugin-specific config keys placed directly on plugins.entries.<id> (e.g. plugins.entries.openshell.policy) are rejected with a bare "Unrecognized key" message that doesn't indicate the correct nesting under .config.

The validation error now suggests the right path:

Unrecognized key(s) in object: "policy"
  (did you mean plugins.entries.openshell.config.policy?
   Plugin-specific settings belong under the "config" key)

The hint is added in the existing Zod issue post-processing pipeline — no schema changes. If the path/message pattern doesn't match, the original message is returned unchanged.

Fixes #60963

Testing

  • 3 new tests in validation.plugin-entry-hint.test.ts: single key hint, multiple key hint, no hint on non-plugin paths
  • Existing validation.policy.test.ts suite passes (5/5)

Note: tsgo in the pre-commit hook fails on 4 pre-existing type errors on main — unrelated to this change. Filed as #62014.

Changed files

  • src/config/validation.plugin-entry-hint.test.ts (added, +68/-0)
  • src/config/validation.ts (modified, +22/-4)

PR #62091: fix(config): append bound hints to numeric ceiling/floor rejections

Description (problem / solution / changelog)

Closes #52500

When a numeric config value violates a .max() or .min() Zod constraint, the error message now appends a structured (maximum: N) or (minimum: N) hint — matching the existing (allowed: ...) pattern already used for enum rejections.

Before: session.agentToAgent.maxPingPongTurns: Number must be less than or equal to 5 After: session.agentToAgent.maxPingPongTurns: Number must be less than or equal to 5 (maximum: 5)

The formatBoundHint helper handles both inclusive (maximum: N) and exclusive (must be less than N) constraints, and is scoped to too_big/too_small Zod issue codes only — it does not affect enum, union, or type-mismatch error paths.

Testing: Two new test cases in validation.allowed-values.test.ts covering ceiling and floor violations against session.agentToAgent.maxPingPongTurns (capped at 0–5). Pre-commit hook skipped due to pre-existing tsgo type errors on main (#62014).

🤖 Generated with Claude Code

Changed files

  • src/config/validation.allowed-values.test.ts (modified, +30/-0)
  • src/config/validation.ts (modified, +29/-8)

Code Example

src/gateway/client.ts(237,13): error TS2322
src/hooks/bundled/session-memory/transcript.ts(6,58): error TS2339
src/plugins/hooks.sync-only.test.ts(20,5): error TS2322
src/plugins/hooks.sync-only.test.ts(21,5): error TS2322
RAW_BUFFERClick to expand / collapse

Bug type

Developer tooling issue

Summary

The pre-commit hook runs pnpm check, which includes tsgo. On current main (as of 2026-04-06), tsgo reports 4 type errors in files unrelated to any staged changes, blocking all local commits without --no-verify.

Steps to reproduce

  1. Clone the repo at current main
  2. Make any change (even a comment)
  3. git commit
  4. Observe tsgo failure

Affected files (none are contributor-touched)

src/gateway/client.ts(237,13): error TS2322
src/hooks/bundled/session-memory/transcript.ts(6,58): error TS2339
src/plugins/hooks.sync-only.test.ts(20,5): error TS2322
src/plugins/hooks.sync-only.test.ts(21,5): error TS2322

Expected behavior

Pre-commit hook passes on a clean checkout of main.

Actual behavior

tsgo fails with 4 type errors, forcing contributors to use --no-verify for all commits.

Impact

Low severity but high friction — every contributor hits this on every commit.

extent analysis

TL;DR

Update the pre-commit hook to exclude files with known type errors or fix the type errors in the affected files.

Guidance

  • Identify and fix the type errors in the affected files (src/gateway/client.ts, src/hooks/bundled/session-memory/transcript.ts, src/plugins/hooks.sync-only.test.ts) to resolve the issue.
  • Consider updating the pre-commit hook to only run tsgo on staged changes, rather than the entire codebase, to reduce friction for contributors.
  • If the type errors are not critical, temporarily exclude the affected files from the tsgo check in the pre-commit hook to allow contributors to commit without using --no-verify.
  • Review the tsgo configuration to ensure it is correctly configured to only check the necessary files.

Example

No code snippet is provided as the issue does not specify the exact changes needed to fix the type errors.

Notes

The issue is specific to the current main branch as of 2026-04-06, so any fixes or workarounds may need to be re-evaluated if the branch changes.

Recommendation

Apply a workaround by updating the pre-commit hook to exclude files with known type errors, as fixing the type errors may require significant changes or discussion.

FAIL-SAFE

If the issue persists after applying the workaround, re-evaluate the tsgo configuration and consider seeking additional help from a TypeScript expert.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Pre-commit hook passes on a clean checkout of main.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING