Skip to content

refactor(server): drop comments the code can say, part 7 of 8 - #4064

Merged
devswha merged 3 commits into
mainfrom
refactor/no-comment-server-7
Nov 17, 2026
Merged

devswha merged 3 commits into
mainfrom
refactor/no-comment-server-7

Conversation

@devswha

@devswha devswha commented Nov 17, 2026

Copy link
Copy Markdown
Owner

What

Part 7 of 8 for server/ in the repo-wide comment pass. This part covers:

  • the runtime move service, seen.ts, session history and plans
  • the shell agent, skill activity and invocations
  • the per-agent skill readers and the walker (server/skills/)
  • the SSH address, askpass, candidates, config and include readers, and ssh.ts
  • the start screen, state documents and state merge
  • static serving, the statusline capture and install
  • the supervisor, system stats, Tailscale and tailnet PCs
  • task routes and telemetry
  • the tests of all of these

About 2,600 comment lines go, and only comments change. Security, trap, platform and measured notes stay (the owner's rule for comment-removal PRs). What stays:

  • The public contract:
    • the GET /api/sessions/history, POST /api/sessions/resume, /api/seen, /api/system, /api/usage/statusline, omo-tasks and ssh-candidates docs
    • the /ws?surface= parameter and POST /api/telemetry compatibility
    • OVIS_PATH_PROBE, which users put in their shell profiles
  • Machine-read comments: the // fixed wait: markers.
  • Behaviour we cannot change:

Every change was checked against origin/main by syntax tree. No test, script or doc reads a deleted comment.

This PR touches SSH (ssh*.ts), telemetry and the Tailscale reader, with comments only. Telemetry's consent rules below deserve the closest look. It waits for a real review (AGENTS.md).

Rules that only a comment stated (deleted, not enforced yet)

Consent and privacy (telemetry.ts)

  • Nothing goes out before the notice is shown, and settings are kept only after it.
  • Nothing kept before an off is sent after it. The off is marked before the lock.
  • No message may reveal when a count changed (hourly resend, midnight).
  • COUNTS_SETTLE_MS stays longer than the client's FLUSH_MS, and the notice versions mirror shared/telemetry-notice.ts.

Security

  • ssh-config.ts and ssh-candidates.ts:
    • The SSH config is read offline and nothing it names is run.
    • ssh -G never runs on the request path.
  • ssh.ts:
    • Git for Windows is searched only in admin-only folders or the account's own profile.
    • The sweep removes only empty, old folders this account owns.
  • Secrets and data:
    • SAFE_ID keeps a session id from being read as a flag.

State and order

  • state-document.ts / state-merge.ts:
    • The kept copy is flushed before the original is removed.
    • mergeSiblingState runs before any store reads.
  • Runtime move:
    • It fails closed when the server's own process group is unknown.
    • The exit command goes only into an empty input line.
  • skills/walk.ts: walks are capped (sibling links are exponential).
  • shell-agent.ts: only absolute login-PATH entries and the fixed SHELL_AGENTS names are looked up.
  • Kept in step: skills/hermes.ts result forms with dialogs/hermes.ts, and start-screen.ts CLAUDE_FAMILY with conversation-metadata.ts.

Left open (redesigns, not done here)

  • Telemetry and Tailscale:
    • telemetry.ts:
      • A hand-rolled lock with four staleness rules.
      • Saved.forgotten is a generation counter.
      • The off-file protocol.
      • A shared single-flight helper.
    • tailscale.ts: its identity cache flags.
  • State merge: mergeDevices' ~170 lines and the two-step publish. statusline-install.ts: its cross-process lock.
  • Runtime move and session history:
    • runtime-move: inputEmpty's true/false/null, and stopPane's positional arguments.
    • session-history-routes.ts RESUME_BUDGET_S is tied to machine-api.ts and Bun.
    • session-plan-reader.ts's fork and held-echo state machine.
  • server/skills/:
    • skills/cmd.ts's budget rules.
    • FRONTMATTER is copied three times (omp.ts, hermes.ts, walk.ts).
    • skills/grok.ts RELEASE_BUILD is always true.
  • SSH:
    • ssh-include.ts keeps a test hook in production.
    • ssh-address.ts samePc's hidden boolean.
  • supervisor.ts: RUST_HOST_STOP_MS is hand-copied.

Validation

  • bun run check fast: passed (18,591 unit tests, typecheck, build, generated themes and types).
  • Unit tests that import a touched module, one file per bun test call: 22 + 48 + 24 files, all passing, both conventions.test.ts files included.
  • Contract tests were edited (comments only) but not run here. CI runs them.

🤖 Generated with Claude Code

devswha and others added 2 commits November 18, 2026 03:01
The seventh server/ slice of the repo-wide comment pass: the runtime
move service, seen, session history and plans, the shell agent, skill
activity and invocations, the per-agent skill readers and walker, the
SSH address, askpass, candidates, config and include readers and
ssh.ts, the start screen, state documents and state merge, static
serving, the statusline capture and install, the supervisor, system
stats, Tailscale and tailnet PCs, task routes and telemetry, with their
tests. About 2,950 comment lines go; the API contract, the `fixed wait:`
markers, and notes on each agent's skill catalog, OpenSSH and
Win32-OpenSSH, glob(3), Tailscale, Claude Code's statusline payload,
RFC 9110 and the PWA install rules stay. Only comments change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Chores
    • Streamlined internal code comments and documentation across runtime, session, skills, SSH, status-line, telemetry, and other server features.
  • Tests
    • Updated and expanded coverage for session history and plans, shell handling, telemetry, and runtime-move behavior.

The diff removes explanatory comments and documentation from many server modules and tests. It also changes damaged-file preservation so non-EEXIST hard-link errors propagate, and it adjusts or adds test assertions and helpers in several areas.

Changes: Runtime move

Layer / File(s) Summary
Move planning, waiting, and stopping
server/runtime-move*.ts
Comments are removed from move-service and route logic. The stop contract test now waits for the force-stop offer before continuing.

Session history and plans

Layer / File(s) Summary
Seen-store persistence and tests
server/seen.ts, server/seen.test.ts
Documentation is removed. Existing persistence, damaged-file, and notification assertions remain.
History listing and resume coverage
server/session-history*.ts
Comments are removed from routes and session readers. Tests retain history and resume assertions, add local Claude test helpers, and add an assertion for reader calls and candidate-store outcomes.
Plan and context tracking
server/session-plan*.ts, server/session-plan*.test.ts
Comments are removed. Tests add or retain checks for Claude context across transcript branches, rewinds, and session changes.

Shell-agent and skill discovery

Layer / File(s) Summary
Shell argument and login-path tests
server/shell-agent.ts, server/shell-agent.test.ts
Comments are removed from shell-agent code. Tests add coverage for argument handling, process lookup, PATH probes, caching, timeouts, and cleanup.
Skill activity and provider discovery
server/skill-activity*, server/skill-invocations/*, server/skills/*
Comments are removed across skill activity, shared walking, and provider discovery. The described discovery and selection behavior remains unchanged.

SSH and tailnet

Layer / File(s) Summary
SSH config, Include, and lookup
server/ssh*.ts, server/ssh*.test.ts
Explanatory comments are removed from SSH parsing, Include handling, lookup, and connection code. Existing implementation and test behavior are otherwise unchanged.
SSH candidates and Tailscale
server/ssh-candidates*, server/tailnet-pcs*, server/tailscale*
Comments are removed and the relay-off fixture variable is renamed. Existing candidate and tailnet checks remain.

Server state and telemetry

Layer / File(s) Summary
Damaged documents and sibling-state merge
server/state-document*, server/state-merge*
keepAs no longer falls back to exclusive copying when hard-link creation fails. State-merge comments are removed; its described behavior remains unchanged.
Telemetry persistence and tests
server/telemetry*
Comments are removed from implementation and tests. The reported telemetry logic remains in place, and tests retain or adjust assertions around its existing scenarios.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Merge Risk: Minimal · previous review b35f5

This is a comment-removal change with no established behavior change. The suspected change to damaged-file preservation was checked and is not present, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: removing comments from server code as part 7 of an 8-part pass. The changeset is comment-only removal across many server files, and the title states that with its scop…
Description check Passed The description follows the template's intent. It explains what changed and lists the scope, the retained public contracts, and the security/platform notes that stay. Validation lists the checks run, …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: removing comments from server code as part 7 of an 8-part pass. The changeset is comment-only removal across many server files, and the title states that with its scope.

Full details: Description check

Explanation

The description follows the template's intent. It explains what changed and lists the scope, the retained public contracts, and the security/platform notes that stay. Validation lists the checks run, with contract tests noted as edited but not run locally. The template's '## Change' and '## Validation' headings are not used verbatim, and the CONTRIBUTING.md and changelog.d entry are not mentioned. Those are minor gaps.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 36a0230 and b35f55c.

Files selected for processing: 106

  • server/runtime-move-service.ts
  • server/runtime-move-stop.contract.test.ts
  • server/runtime-move-stop.test.ts
  • server/runtime-move-wait.contract.test.ts
  • server/runtime-move.test.ts
  • server/runtime-move.ts
  • server/secret.contract.test.ts
  • server/seen.test.ts
  • server/seen.ts
  • server/session-history-routes.ts
  • server/session-history.test.ts
  • server/session-history.ts
  • server/session-plan-reader.ts
  • server/session-plan-readers.test.ts
  • server/session-plan.fixture.ts
  • server/session-plan.test.ts
  • server/session-plan.ts
  • server/shell-agent.test.ts
  • server/shell-agent.ts
  • server/skill-activity.test.ts
  • server/skill-activity.ts
  • server/skill-invocations/agy.ts
  • server/skill-invocations/claude.ts
  • server/skill-invocations/devin.ts
  • server/skills/agy.test.ts
  • server/skills/agy.ts
  • server/skills/claude.test.ts
  • server/skills/claude.ts
  • server/skills/cmd.test.ts
  • server/skills/cmd.ts
  • server/skills/codex.test.ts
  • server/skills/codex.ts
  • server/skills/copilot.test.ts
  • server/skills/copilot.ts
  • server/skills/devin.test.ts
  • server/skills/devin.ts
  • server/skills/gjc.test.ts
  • server/skills/gjc.ts
  • server/skills/grok.test.ts
  • server/skills/grok.ts
  • server/skills/hermes.test.ts
  • server/skills/hermes.ts
  • server/skills/index.ts
  • server/skills/letta.test.ts
  • server/skills/letta.ts
  • server/skills/omo.test.ts
  • server/skills/omo.ts
  • server/skills/omp.test.ts
  • server/skills/omp.ts
  • server/skills/opencode.test.ts
  • server/skills/opencode.ts
  • server/skills/pi.test.ts
  • server/skills/pi.ts
  • server/skills/walk.test.ts
  • server/skills/walk.ts
  • server/ssh-address.ts
  • server/ssh-candidates.contract.test.ts
  • server/ssh-candidates.fixture.ts
  • server/ssh-candidates.include.test.ts
  • server/ssh-candidates.test.ts
  • server/ssh-candidates.ts
  • server/ssh-config.ts
  • server/ssh-glob.ts
  • server/ssh-include-dir.ts
  • server/ssh-include-glob.ts
  • server/ssh-include.getdents.test.ts
  • server/ssh-include.held.test.ts
  • server/ssh-include.ts
  • server/ssh-lookup.test.ts
  • server/ssh-lookup.ts
  • server/ssh.test.ts
  • server/ssh.ts
  • server/start-screen.contract.test.ts
  • server/start-screen.test.ts
  • server/start-screen.ts
  • server/startup-order.test.ts
  • server/state-document.test.ts
  • server/state-document.ts
  • server/state-merge.test.ts
  • server/state-merge.ts
  • server/static-encoding.test.ts
  • server/static.ts
  • server/statusline-capture.ts
  • server/statusline-context.test.ts
  • server/statusline-context.ts
  • server/statusline-install.test.ts
  • server/statusline-install.ts
  • server/statusline-lock.test.ts
  • server/statusline-switch.contract.test.ts
  • server/statusline.test.ts
  • server/statusline.ts
  • server/submit.contract.test.ts
  • server/supervisor.ts
  • server/system-stats.test.ts
  • server/system-stats.ts
  • server/tailnet-pcs.contract.test.ts
  • server/tailnet-pcs.ts
  • server/tailscale.test.ts
  • server/tailscale.ts
  • server/take-over.contract.test.ts
  • server/tasks-routes.ts
  • server/telemetry.test.ts
  • server/telemetry.ts
  • server/terminal-insert.contract.test.ts
  • server/tool-output.ts
  • server/transcript-reader.test.ts
Files with no reviewable changes: 77

  • server/runtime-move-stop.contract.test.ts
  • server/runtime-move-stop.test.ts
  • server/runtime-move-wait.contract.test.ts
  • server/runtime-move.test.ts
  • server/runtime-move.ts
  • server/secret.contract.test.ts
  • server/seen.test.ts
  • server/seen.ts
  • server/session-history-routes.ts
  • server/session-history.test.ts
  • server/session-plan-readers.test.ts
  • server/session-plan.fixture.ts
  • server/session-plan.test.ts
  • server/session-plan.ts
  • server/skill-activity.test.ts
  • server/skill-activity.ts
  • server/skill-invocations/agy.ts
  • server/skill-invocations/claude.ts
  • server/skill-invocations/devin.ts
  • server/skills/agy.test.ts
  • server/skills/claude.test.ts
  • server/skills/claude.ts
  • server/skills/cmd.test.ts
  • server/skills/codex.test.ts
  • server/skills/copilot.test.ts
  • server/skills/devin.test.ts
  • server/skills/gjc.test.ts
  • server/skills/grok.test.ts
  • server/skills/hermes.test.ts
  • server/skills/index.ts
  • server/skills/letta.test.ts
  • server/skills/letta.ts
  • server/skills/omo.test.ts
  • server/skills/omp.test.ts
  • server/skills/opencode.test.ts
  • server/skills/pi.test.ts
  • server/skills/walk.test.ts
  • server/ssh-address.ts
  • server/ssh-candidates.contract.test.ts
  • server/ssh-candidates.fixture.ts
  • server/ssh-candidates.include.test.ts
  • server/ssh-candidates.test.ts
  • server/ssh-candidates.ts
  • server/ssh-config.ts
  • server/ssh-glob.ts
  • server/ssh-include-dir.ts
  • server/ssh-include-glob.ts
  • server/ssh-include.held.test.ts
  • server/ssh-include.ts
  • server/ssh-lookup.test.ts
  • server/ssh-lookup.ts
  • server/ssh.test.ts
  • server/start-screen.contract.test.ts
  • server/start-screen.test.ts
  • server/start-screen.ts
  • server/startup-order.test.ts
  • server/state-document.test.ts
  • server/state-merge.test.ts
  • server/static-encoding.test.ts
  • server/static.ts
  • server/statusline-capture.ts
  • server/statusline-context.test.ts
  • server/statusline-install.test.ts
  • server/statusline-switch.contract.test.ts
  • server/statusline.test.ts
  • server/statusline.ts
  • server/system-stats.test.ts
  • server/tailnet-pcs.contract.test.ts
  • server/tailnet-pcs.ts
  • server/tailscale.test.ts
  • server/tailscale.ts
  • server/take-over.contract.test.ts
  • server/tasks-routes.ts
  • server/telemetry.test.ts
  • server/terminal-insert.contract.test.ts
  • server/tool-output.ts
  • server/transcript-reader.test.ts

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

@devswha
devswha merged commit e0a87bc into main Nov 17, 2026
25 checks passed
@devswha

devswha commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head 0f5e5fc5c85f as e0a87bcd91f8 on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
machine-proof CLEAR
rule3 CLEAR

The owner's refactor (server, part 7 of 8), merged by the merge pass on his word under rule 3. A machine proof removed comments and compared the merge base with the owner's head: all 106 files are identical, so no code changes and no code review was needed.

The deleted comments were searched for the five kinds the owner keeps (256 distinct hit lines); a fresh reviewer kept 21 blocks, put back word for word by the merge pass's worker: Windows path rules in server/session-history.ts (8.3 short names, the \\?\ prefixes, letter case) and why an empty home must not give a relative store path; which agents start on Windows and a SIGKILL that may not end the process in server/shell-agent.ts; skill-folder facts for Claude, Codex, Devin, omp and pi, including a frontmatter pattern that was quadratic on a file cut at 64 KiB; ssh facts (IPv6 zone ids, Git for Windows' install folder); a sequence counter used because the clock can go back; and the telemetry receiver's 8 KiB event limit.

@devswha
devswha deleted the refactor/no-comment-server-7 branch November 17, 2026 18:36
devswha added a commit that referenced this pull request Nov 18, 2026
)

## What

#4064 (`server/`, part 7 of 8) was part of the repo-wide comment pass
and merged before the owner's rule for comment-removal PRs: security
notes, platform facts, measured values, third-party attribution, Rust
SAFETY notes and traps that name a concrete breakage stay. This PR puts
back what it dropped of those, word for word where the code is
unchanged, on today's `main`.

How the notes were picked: a Codex adversarial review (gpt-6.2-sol,
reasoning high) of the merged commit against its parent listed every
deleted comment it took for a kept kind; each finding was checked
against the code before the pass and today's file, and put back only
when it is one of those kinds. A trap came back only when it names what
the obvious change would break. Notes whose code has since moved sit on
that code now; notes whose code is gone, or that are no longer true,
stay out.

Comments only: no code changes. The refactor-merge kit's `proof.sh`
checks that every file is identical once comments are removed; lint
directives (which it counts as code) stay out.

## Details

### Lines restored per kind

| kind | findings accepted | lines |
|---|---|---|
| security | 271 | 470 |
| platform fact | 252 | 413 |
| trap (concrete breakage) | 57 | 93 |
| measured value | 17 | 36 |
| third-party attribution | 3 | 4 |
| total | 600 | 1016 |

Telemetry consent and privacy notes (what leaves the PC, notice and off
gates, generations,
the hourly throttle) count as security (permission to send). Mixed
blocks were cut to the kept
sentences, word for word; a few were reflowed.

Declined: 53 (46 traps that only give a design reason, describe the code
or a test fixture;
6 security findings that are not security notes; 1 measured finding with
no measured value).
Already on main: 0 (every finding's line was still missing from
origin/main).
Skipped: 5 LOW and 21 "false body claim" findings (PR body, merged).

No file was held: the provers and verify.ts passed on the whole commit.

### Security notes put back (file: a few words)

- runtime-move-service.ts (12): `guard` asked right before keys are
written; force only after the same command survived Ctrl+C; End all
token for exactly the shown list, used once; cancel during a herdr
answer sends nothing; exec may change the program, only the shown
command is interrupted
- session-history-routes.ts (4): no resume without proof of the new
tab's store; answer without processes is no answer; pane checked before
any store is read; unrepeatable store withholds Resume
- session-history.ts (9): failed or outside resolutions still spend a
check; checked file read by descriptor only; SAFE_ID cannot be read as
another option; regular file inside the store; SQLite stores read-only,
resolved inside the store, O_NOFOLLOW
- session-history.test.ts (7): file or database swapped for a link after
the check; unchecked reader would follow it; no processes never means
the default store; refusals name no store path or prompt
- secret.contract.test.ts (4), submit.contract.test.ts (8),
terminal-insert.contract.test.ts (4): scrolled viewport is no authority;
authority can change while a check awaits herdr; a second bridge cannot
write to the held PTY; stale authority refused and the secret buffer
erased; no CR, LF, ESC or key after inserted text
- seen.ts (1), tailnet-pcs.ts, telemetry.ts: a body that lies about its
length is cut off or measured
- shell-agent.ts (2), shell-agent.test.ts (2): only fixed names and
absolute executables; a relative PATH entry would make the server's
folder an agent; cmd expands % and !NAME! inside quotes
- skill-activity*, skill-invocations/agy.ts, claude.ts (5): no
filesystem lookup for transcript evidence; envelope tags and later items
cannot forge a skill invocation
- skills/omp.ts, omo.ts, opencode.ts, walk.ts, hermes.ts (7): foreign
tools' config is opt-in; project configs and skill files are bounded
regular files; destructive Hermes commands confirm unless --yes
- ssh-config.ts (7), ssh-include.ts (9), ssh-include-dir.ts (3),
ssh-candidates*.ts (4), ssh-address.ts (1): read offline, nothing the
config names is run; exec/localnetwork Match unknown; path-listed or
swapped includes claim no PC; openat relative to a held folder; only
ENOENT is nothing; tests never use the account's ssh
- ssh.ts (6), ssh.test.ts (1): temp sweep leaves what is not ours; Git
for Windows only from admin-owned or the account's own folders;
Tailscale SSH check URL and control characters; helper token known only
to this connection's ssh; remote output capped, nothing past the cap
taken
- state-merge.ts (21), state-merge.test.ts (7): failed or unreadable
merges stay gated; revoked devices never come back; placeholder
registries revoke nothing; push subscriptions only with the key pair
they were made for
- state-document.ts (1): private temp file, `.bad` kept 0600, write
refused when it cannot be kept
- static.ts (5): CSP frame-src and connect-src; a CSP host cannot end or
add a directive; report-only vs enforce; origin from X-Forwarded-Proto
and Host
- statusline-capture.ts (4), statusline-context.ts (5),
statusline-install.ts (15), statusline-install.test.ts (1),
statusline-switch.contract.test.ts (2): only marked regular files are
ours; links could point writes or deletions anywhere; never overwrite a
newcomer; removal restores only what it replaced; a watching device
cannot turn the switch, body is on/off only
- supervisor.ts (3): profile-marked folder is outside the launch;
installs only the revision it names; unbound install refused
- tailnet-pcs.ts (6), tailnet-pcs.contract.test.ts (3), tailscale.ts
(7), tailscale.test.ts (4): only listed addresses of this login are
asked for a code, for a limited time; sole-owner proof rules (tags,
offline peers, rounded ids); login rereads throttled
- telemetry.ts (72), telemetry.test.ts (20): nothing goes before the
notice or while off; off kept in its own file and marked before the
lock; generations stop work begun before an off; only buckets leave the
PC; hourly usage throttle holds over midnight; checks right before each
send

## Validation

- `bun run check fast`: passed (18,593 unit tests, typecheck, build,
generated themes and types).
- `proof.sh` (comments only), `ready.sh` (required checks, threads,
CodeRabbit, main) before the merge.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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