Skip to content

fix(keybindings): stop "unknown keybinding action" log flood - #724

Merged
edenreich merged 2 commits into
mainfrom
fix/keybindings-unknown-action-flood
Jul 2, 2026
Merged

edenreich merged 2 commits into
mainfrom
fix/keybindings-unknown-action-flood

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

Fixes the flood of unknown keybinding action warnings in ~/.infer/logs/app-<date>.log - about 84 lines per infer chat launch (42 warn + 42 error), even with a stock infer init config.

Root cause

  • Structural drift (the flood). config.GetDefaultKeybindings() includes 41 namespace-path actions (chat_focus_attachments, all diff_viewer_*, all explorer_*) that are consumed directly via config.ResolveNamespaceBindings and are never registered in the runtime Registry. (*Registry).ApplyConfigOverrides warned for every config ID absent from the registry, so it false-flagged all 41 on every launch. The CLI validator getValidActionIDs() shared the same blind spot.
  • Logger misuse (doubled the noise). registry.go:364 called logger.Warn("... '%s' ...", actionID), but logger.Warn(msg, args...) forwards to zap's key/value sugared API (Warnw). So %s never expanded and the trailing actionID became a dangling key - which is why zap added a second, error-level Ignored key without a value. line.

Fix

  • New config.DefaultKeybindingActionIDs() - the config-side valid-ID set.
  • ApplyConfigOverrides now warns only for IDs in neither the registry nor the defaults (exact-ID match, so genuine typos and stale/removed IDs still warn once), and logs structured ("action", id). The sibling misuse at registry.go:36 is fixed too.
  • New Registry.KnownActionIDs() (registry union defaults); the CLI validator uses it so infer keybindings validate/set/enable/disable agree with the runtime.
  • Regression tests: a stock config is silent; a genuine/namespace typo warns exactly once with a structured action field and zero Ignored key lines; the validator includes namespace-path IDs.

Verification

  • task build, task lint (0 issues), go test ./... all pass.
  • infer keybindings validate against a real stale config: 42 -> 1 unknown ID (only the genuinely-removed plan_approval_..._accept_and_auto_approve from fix(plan): accepting a plan switches to auto-accept mode by default #714). Runtime flood drops from 84 lines/launch to at most 1 clean structured warning.

Notes

  • No config regeneration - GetDefaultKeybindings() output is unchanged.
  • The doubled plan_approval_plan_approval_ prefix is intentionally left as-is (identical between registry and defaults; renaming would break existing user configs).
  • The same printf-style structured-logger misuse exists at ~18 other call sites (same defect class, malformed logs); tracked separately in [BUG] Structured logger misused printf-style at ~20 call sites (malformed logs) #723.

Closes #722

ApplyConfigOverrides validated the user config only against the runtime
registry, so the 41 namespace-path actions (chat_focus_attachments,
diff_viewer_*, explorer_*) consumed via config.ResolveNamespaceBindings were
false-flagged as "unknown" on every launch. The warning was logged printf-style
through the structured zap wrapper, so %s never expanded and the action leaked
into a spurious error-level "Ignored key without a value." line.

Validate config action IDs against the union of registry-registered IDs and
default-config IDs (exact-ID, so real typos/stale IDs still warn once), convert
the log call to structured form, and share the union with the CLI validator so
`infer keybindings validate/set/enable/disable` agree with the runtime.

Closes #722
@edenreich
edenreich requested a review from a team as a code owner July 2, 2026 14:16
@edenreich edenreich added this to 2026 Jul 2, 2026
@edenreich edenreich moved this to QA in 2026 Jul 2, 2026
@edenreich
edenreich merged commit c828426 into main Jul 2, 2026
1 check passed
@edenreich
edenreich deleted the fix/keybindings-unknown-action-flood branch July 2, 2026 14:37
edenreich added a commit that referenced this pull request Jul 2, 2026
## Summary

`internal/logger`'s `Debug/Info/Warn/Error/Fatal(msg string, args
...any)` forward to zap's sugared
**key/value** API (`Warnw`/`Errorw`/…). ~18 call sites instead passed a
**printf-style** format string
(`%s`/`%v`/`%d`) with trailing positional args, so:

- the verbs were never expanded (a literal `%s` landed in the log), and
- the trailing args were misread as key/value pairs — an **odd** count
left a dangling key, making zap
  emit an extra `error`-level `Ignored key without a value.` line.

This is the same defect class as the keybinding log flood (#722, fixed
in #724, which corrected the two
worst offenders and tracked the rest in #723). This PR closes the
remaining sites.

## Changes

- **Convert 18 call sites to structured key/value form**, following the
#724 precedent
(`logger.Warn("failed to …", "error", err)`). Multi-word keys use the
repo's snake_case house style
  (`chat_id`, `original_bytes`).
- `internal/ui/keybinding/actions.go` (7),
`internal/agent/agent_utils.go` (5),
`internal/services/channels/telegram.go` (4), `internal/app/chat.go`
(1),
    `internal/container/container.go` (1)
- **Enable the `loggercheck` linter** (`no-printf-like` + wrapper rules
for `internal/logger.*`) so
  this class cannot regress.

The 9 other logger calls that contain a `%` were verified as correct
`fmt.Sprintf` usage (message
pre-formatted, or building a properly-keyed value) and left untouched.

## Verification

- `task build`, `task test` (full suite), and `task lint` (**0 issues**,
loggercheck active) all pass.
- Confirmed the guard is live: a deliberate misuse is flagged by
loggercheck
(`odd number of arguments passed as key-value pairs for logging`); the
fixed tree lints clean.

no docs ticket: internal-only fix

Closes #723

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
@edenreich edenreich moved this from QA to Done in 2026 Jul 2, 2026
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 3, 2026
## [0.128.0](v0.127.0...v0.128.0) (2026-07-03)

### 🚀 Features

* **chat:** make status indicators selectable with /tools and /a2a views ([#732](#732)) ([6882de0](6882de0)), closes [#717](#717) [#717](#717)

### 🐛 Bug Fixes

* **agent:** drop redundant Idle transition that errored on every run ([#726](#726)) ([469ec64](469ec64)), closes [#722](#722) [#725](#725)
* **agent:** report session-cumulative total_turns in completion logs ([#728](#728)) ([0d8fb08](0d8fb08)), closes [#727](#727)
* **a2a:** route active A2A reads and HasPending through the job supervisor ([#693](#693)) ([#721](#721)) ([dcd0670](dcd0670)), closes [#718](#718) [#719](#719) [#720](#720)
* **keybindings:** stop "unknown keybinding action" log flood ([#724](#724)) ([c828426](c828426)), closes [#714](#714) [#722](#722)
* **a2a:** unify background-job liveness, clear, and cancel on the supervisor contract ([#730](#730)) ([eb37fd0](eb37fd0)), closes [#693](#693) [#720](#720) [#718](#718) [#719](#719)
* **logging:** use structured key/value form at misused call sites ([#729](#729)) ([cd96028](cd96028)), closes [#722](#722) [#724](#724) [#724](#724) [#723](#723)
* **tools:** wait for pipe readers before reaping detached bash shells ([#716](#716)) ([e1d0d84](e1d0d84)), closes [#696](#696)

### ⚡ Performance Improvements

* **tui:** cache per-entry rendering and keep the Update loop responsive ([#731](#731)) ([8c9db0d](8c9db0d))

### 📚 Documentation

* **a2a:** add SKILL.md documentation for Agent2Agent protocol ([defcd57](defcd57))

### 🔧 Build System

* **deps:** bump golang.org/x/net from 0.47.0 to 0.55.0 in /examples/mcp/mcp-server ([#715](#715)) ([990803b](990803b))

### 🧹 Maintenance

* **flox:** bump dev deps ([d0c8f6b](d0c8f6b))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.128.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] Keybindings: "unknown keybinding action" log flood on every chat launch

1 participant