Skip to content

fix(native-chat): move the chat-tab surface out of the session host so main passes lint - #24496

Merged
Jinwoo-H merged 1 commit into
mainfrom
jinwoo/fix-structured-agent-session-host-max-lines
Oct 2, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
jinwoo/fix-structured-agent-session-host-max-lines

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​52 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36

ELI5

Main has failed its lint check on every commit since #24203 and #24311 landed. One file grew two lines past the 300-line limit. This PR moves a small, self-contained part of that file into the module that already holds its logic, so the check passes again. Nothing the user sees changes.

What Changed

  • Before: structured-agent-session-host.ts was 302 counted lines (limit 300). The static-analysis job failed on main and on every PR based on it: File has too many lines (302).
  • After: the file is back under the limit, and lint passes on the whole repo.
  • Mechanism: the session host exposed five chat-tab members inline: list the tabs, read the saved visible-tab order, read a chat's tab id, show tabs, and set a tab's visibility. The last one also forgot the chat's status once its tab closed with no agent running. These five members are now built by createStructuredAgentSessionTabSurface in structured-agent-session-host-tabs.ts, the module that already held the tab listing and visibility logic. The host assigns them under the same public names and signatures. The new function reads host.deps, host.restartResume, and the status forget at call time, just as the old inline code did, so the host's wrapped logger and its late-built restart-resume helper are still the ones used.

Why

Of the options, I chose the one that groups related code. The tab members form one unit, and their logic already lived in the tabs module, so moving them there sets up no new dependency. Squeezing lines (merging statements, dropping comments) would only put off the next overflow, and raising the limit or adding a lint disable is not allowed.

This pairs with #24494, which fixes the typecheck half of the same breakage (the renamed remote-runtime capability list). This PR does not touch those files.

Linked Issue

N/A (maintainer fix for a red main)

Visual Proof

N/A. This is an internal refactor with no visual or interaction change.

Testing

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No platform, SSH, mobile, or wire impact: this is a main-process refactor inside one host class, and its public members keep the same names and signatures.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred). Typecheck stays red until fix(build): import the Electron remote capability list from its own module #24494 lands.

…o main passes lint

The host file reached 302 lines after #24203 and #24311, over the 300-line limit,
so the static-analysis job failed on every commit to main. The five chat-tab
members now come from createStructuredAgentSessionTabSurface in the existing
structured-agent-session-host-tabs module; behaviour is unchanged.
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Refactors chat tab surface methods into a factory function.

The refactor appears safe to merge; no actionable regression was identified.

Summary

The PR moves five chat-tab methods from the session host into its existing tabs module to bring the host below the lint line limit. Their public signatures and call-time access to host state remain unchanged.

Reviews (1) · Last reviewed commit: "fix(native-chat): move the chat-tab surf..."

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 72d2e6c6-03a4-4800-b697-82ae06eb4d65

📥 Commits

Reviewing files that changed from the base of the PR and between e3cb327 and 13050ed.

📒 Files selected for processing (2)
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-tabs.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts

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


📝 Walkthrough

Walkthrough

The host now delegates tab listing, persisted-index and tab-ID lookups, tab display, and visibility updates to a new tab surface. The surface uses the host’s store. After a successful hide, it calls the supplied forgetStatus callback if the session has no child.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 13050

This is an internal refactor that moves tab handling out of the session host to satisfy the line-limit lint. No user-visible behavior change is expected, and no actionable merge-blocking risk remains.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 13050

The change preserves existing tab operations, persistence behavior, and cleanup conditions. No new caller access, privileges, or materially weakened controls were identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The extraction does not expand effective caller scope: the host remains the sole identified production caller of the factory, and the same host-facing operations reach the same persistence and lifecycle sinks.

Trust Boundaries and Controls

  • observed — Session identifiers, visibility values, and optional tab identifiers are forwarded unchanged. Existing store transactions and tab-table session preconditions remain in place; the extracted surface does not introduce a direct persistence bypass.

Resilience and Maintainability Implications

  • observed — Recovery dismissal on hide remains best-effort and separate from visibility persistence, with failures logged through the host logger. This behavior predates the extraction; the change adds no new async boundary or recovery transition.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: moving the chat-tab surface out of the session host to resolve the lint failure. It is specific and relevant.
Description check ✅ Passed The description is complete and relevant. It explains the problem, change, rationale, validation, lack of user-visible impact, linked-issue exception for a maintainer fix, and checklist status. It als…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This is a mechanical extraction that gets main under the max-lines cap again, with no behavior change.

  • Chat-tab surface moved into the tabs module — the host's five tab members are now built by createStructuredAgentSessionTabSurface in structured-agent-session-host-tabs.ts; the host aliases the returned functions under the same public names/signatures.
  • Late-bound reads preserved — the factory takes host (this) and reads host.deps / host.restartResume inside its closures, so the wrapped logger and the constructor-built restartResume are still resolved per call. sessions and forgetStatus are captured once, but this.sessions is readonly and never reassigned, so the close check is equivalent.
  • max-lines reduction — structured-agent-session-host.ts is back under 300 counted lines; the ratchet baseline (config/max-lines-baseline.txt) tracks suppression entries only, so it needs no update.

Verified locally: oxlint on both files is clean; typecheck:node shows only the 4 pre-existing #24494 errors, none in the changed files; the host/close/forget-status tests pass (50/50).

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

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