Skip to content

fix: resolve UTF-8 boundary panics in session resume#113

Merged
yishuiliunian merged 3 commits intomainfrom
fix/utf8-truncation-panic
Apr 16, 2026
Merged

fix: resolve UTF-8 boundary panics in session resume#113
yishuiliunian merged 3 commits intomainfrom
fix/utf8-truncation-panic

Conversation

@yishuiliunian
Copy link
Copy Markdown
Contributor

Summary

  • Fix panic when resuming sessions with CJK/multi-byte tool inputs (byte index 57 is not a char boundary)
  • Fix identical unsafe byte-slicing in background task truncate_cmd
  • Surface resume failures to user instead of silent empty screen

Changes

  • crates/loopal-protocol/src/projection.rssummarize_input() uses is_char_boundary loop
  • crates/tools/process/bash/src/bg_monitor.rstruncate_cmd() safe truncation + 6 tests
  • src/bootstrap/multiprocess.rsmatch with error message on resume failure
  • crates/loopal-protocol/tests/suite/projection_edge_test.rs — 2 regression tests with precondition assertions

Test plan

  • bazel test //crates/loopal-protocol:loopal-protocol_test — passes
  • bazel test //crates/tools/process/bash/... — passes
  • bazel build //... --config=clippy — zero warnings
  • CI passes

…n resume

Byte-index slicing on multi-byte UTF-8 strings caused panics when
resuming sessions containing CJK tool inputs.

- projection.rs: summarize_input() now walks back to valid char boundary
- bg_monitor.rs: truncate_cmd() uses is_char_boundary + saturating_sub
- multiprocess.rs: surface resume failures to user instead of silent no-op
@yishuiliunian yishuiliunian merged commit 4ce1fb0 into main Apr 16, 2026
4 checks passed
yishuiliunian added a commit that referenced this pull request Apr 16, 2026
…113)

Structured tasks (TaskCreate/TaskUpdate) are now displayed in a dedicated
panel alongside Agents and BgTasks, with a unified PanelProvider registry
that drives navigation, rendering, and lifecycle cleanup.

Event pipeline: TaskStore → TaskBridge → TasksChanged → SessionState → TUI.
Panel system: PanelProvider trait + PanelRegistry replaces per-kind dispatch.
Cleanup: session state auto-evicts finished agents, completed bg_tasks, and
completed tasks to prevent unbounded growth in long-running sessions.
yishuiliunian added a commit that referenced this pull request Apr 16, 2026
…117)

* feat(tui): add Tasks panel with PanelProvider registry architecture (#113)

Structured tasks (TaskCreate/TaskUpdate) are now displayed in a dedicated
panel alongside Agents and BgTasks, with a unified PanelProvider registry
that drives navigation, rendering, and lifecycle cleanup.

Event pipeline: TaskStore → TaskBridge → TasksChanged → SessionState → TUI.
Panel system: PanelProvider trait + PanelRegistry replaces per-kind dispatch.
Cleanup: session state auto-evicts finished agents, completed bg_tasks, and
completed tasks to prevent unbounded growth in long-running sessions.

* fix: rustfmt formatting for all new and modified files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant