Repository navigation
Fix Linux IBus reset recovery and duplicate-event boundary - #14
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🔵 Needs a closer look
It alters the password/sensitive-field kill-switch behavior, a security-critical privacy boundary that warrants final human review despite being small and well-tested.
0 open findings
What changed in this PR
This PR hardens the Linux IBus adapter's sensitive-field "kill switch" so that a failed native-core reset() no longer leaks protection. Previously, leaving a sensitive field flipped _sensitive off and discarded composition state even if the core reset threw; now the flag stays armed throughout the reset in both directions and is released only after an explicit ordinary declaration whose reset actually succeeds, while adapter-side cleanup (preedit, buffers, in-flight key counter, surrounding text) still runs after a refusal. It fits into the engine's documented privacy boundary for password/unknown content types.
Changes:
_reset_for_sensitive_switchreturns whether the core reset succeeded.do_set_content_typekeeps_sensitivearmed during the reset and only clears it on a successful reset when leaving a sensitive field; trace now reports the effective post-reset state.- Added focused regression tests covering reset-refusal recovery, staying sensitive during the reset, and adapter-state cleanup after a refusal (including a refusing preedit takedown).
| File | Description |
|---|---|
ibus/smartkey_engine.py |
Returns reset-success from _reset_for_sensitive_switch; keeps the sensitive kill switch armed across a failed reset and only releases it on a successful ordinary-declaration reset; trace reflects effective state. |
ibus/test_input_safety.py |
Adds regression tests for reset-refusal recovery, remaining sensitive during the reset, and adapter-state cleanup after refusal. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
When a native-core reset fails, acknowledge the fallback reset before processing normal input and clear the duplicate-event boundary. This preserves recovery behavior without carrying stale reset or deduplication state into the next key event.
Changes are limited to the Linux IBus adapter and its focused regression tests. Validation includes the prior 110-test source acceptance, 13 native tests and 119 adapter tests, and a real private IBus run covering a synthetic document, privacy boundaries and reset recovery. Independent review accepted the exact source candidate
d1ceb1d1bf4a830a3c903b38423e4b286fda23d4.The private IBus result does not establish deployment or acceptance in the user's active desktop. This PR does not install or switch the live keyboard engine and is separate from Windows packaging PR #13.