Skip to content

fix(id): deliver the dropped-input notice in SSH explorer sessions - #735

Merged
dezren39 merged 1 commit into
mainfrom
sweep/723-explorer-dropped-input-notice
Oct 24, 2026
Merged

dezren39 merged 1 commit into
mainfrom
sweep/723-explorer-dropped-input-notice

Conversation

@dezren39

@dezren39 dezren39 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Fixes #723

Problem

PR #720 wired the shared dropped-input counter into the world shell (SshIo::send), but the explorer branch of the same shell_request spawned run_explorer with no counter. The russh data() handler counts refused bytes for explorer sessions too, so those drops were counted on a counter nobody claimed — explorer viewers never saw the [-- input dropped: N bytes ... --] notice.

Solution

  • shell_request's explorer branch now clones the same Arc<AtomicUsize> the handler counts on and passes it into run_explorer.
  • New prepend_dropped_input_notice helper claims the notice via the existing claim_dropped_input_notice / INPUT_DROP_NOTICE_BYTES (1024) threshold and prepends it to the explorer's next output. If the channel write fails, run_explorer restores the claimed bytes with fetch_add — the same reset-only-on-delivery rule as SshIo::send, so drops are neither lost nor double-counted. A notice alone (empty output chunk) is still sent.
  • New test explorer_notice_prepends_to_next_output_and_stays_quiet_below_threshold drives the shared counter the way the handler does: below-threshold drops stay quiet and counted, at-threshold drops prepend the notice and drain the counter, and a restored claim can be claimed again.

World-shell behaviour from #720 is unchanged.

Single-repo: pkgs/id SSH code lives only in developing-today/code (verified in #723).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • New Features
    • Explorer sessions now display a notice when at least 1,024 bytes of input have been refused, helping make input loss visible.
  • Bug Fixes
    • Notices are only counted as delivered after a successful write, so failed deliveries can be reported again. Below the threshold, explorer output remains unchanged.

Explorer sessions counted refused input bytes on the shared counter
(from #720) but run_explorer never claimed the notice, so explorer
viewers silently lost input under load. Pass the shared
Arc<AtomicUsize> into run_explorer and prepend the claimed notice to
the next explorer output, restoring the claim on write failure.

Fixes #723
@dezren39
dezren39 requested a review from a team as a code owner October 24, 2026 09:19
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42d88207-d2f3-4e4e-8094-127f5700d05c
Commits

Reviewing files that changed from the base of the PR and between 5db6087 and 5fb73e3.

Files selected for processing: 1
  • pkgs/id/src/world_ssh.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Explorer sessions now use the connection’s shared dropped-input counter. When dropped input reaches 1024 bytes, run_explorer prepends a notice to output. If writing fails, it restores the claimed count.

Changes: Explorer dropped-input notices

Layer / File(s) Summary
Pass the counter to explorer sessions
pkgs/id/src/world_ssh.rs
The explorer shell passes the shared dropped-input counter to run_explorer.
Claim and deliver notices
pkgs/id/src/world_ssh.rs
run_explorer prepends a notice when the threshold is reached and restores the claimed count after a failed write. Tests cover below-threshold behavior, notice ordering, and restoration.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant shell_request
  participant run_explorer
  participant SharedDroppedInputCounter
  participant ExplorerChannel
  shell_request->>run_explorer: pass shared dropped-input counter
  run_explorer->>SharedDroppedInputCounter: claim notice at threshold
  run_explorer->>ExplorerChannel: write explorer output with notice
  ExplorerChannel-->>run_explorer: report write failure
  run_explorer->>SharedDroppedInputCounter: restore claimed count
Loading

Possibly related issues

Possibly related PRs

  • developing-today/code#720 — Adds the shared counter and claim/restore notice behavior that this change uses for explorer output.
Merge Risk: Minimal · up to 5fb73

No actionable issue remains that should block merging the explorer dropped-input notice change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: delivering dropped-input notices in SSH explorer sessions.
Linked Issues check Passed For directly linked issue #723, the supplied PR evidence states that the explorer branch clones the shared Arc<AtomicUsize> and passes it to run_explorer. It also states that the new helper uses `…
Out of Scope Changes check Passed The supplied change summary contains one file with +64/-1 lines. The reported changes only connect explorer sessions to the shared dropped-input counter, deliver the required notice, restore failed cl…
Full details: Linked Issues check

Explanation

For directly linked issue #723, the supplied PR evidence states that the explorer branch clones the shared Arc&lt;AtomicUsize&gt; and passes it to run_explorer. It also states that the new helper uses claim_dropped_input_notice and INPUT_DROP_NOTICE_BYTES, prepends the notice, restores claimed bytes on write failure, and sends an empty notice chunk when needed. The new test covers below-threshold counting, threshold delivery, counter draining, and reclaiming. The reviewed head file confirms the shared counter is cloned in the explorer branch. The reported world-shell changes remain unchanged.

Full details: Out of Scope Changes check

Explanation

The supplied change summary contains one file with +64/-1 lines. The reported changes only connect explorer sessions to the shared dropped-input counter, deliver the required notice, restore failed claims, and test that behavior. These changes directly implement issue #723 and do not demonstrate unrelated scope.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.99.0)

Clippy execution timed out

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

id(ssh): PR #720's dropped-input notice still cannot fire in explorer sessions — the shared counter is counted for them but never claimed

1 participant