Skip to content

(janitor/comments) remove narrating and restating comments from cloud-agent chat module - #8933

Open
kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
janitor/comments-cloud-agent-chat
Open

kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
janitor/comments-cloud-agent-chat

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Package / topic area cleaned

apps/web/src/components/cloud-agent/ — the cloud-agent chat module (chat message types, session-config derivation, message content rendering, session store atoms, org models hook).

Files touched

  • apps/web/src/components/cloud-agent/types.ts
  • apps/web/src/components/cloud-agent/session-config.ts
  • apps/web/src/components/cloud-agent/MessageContent.tsx
  • apps/web/src/components/cloud-agent/store/db-session-atoms.ts
  • apps/web/src/components/cloud-agent/store/session-form-atoms.ts
  • apps/web/src/components/cloud-agent/hooks/useOrganizationModels.ts

Comment lines removed

177 comment lines (184 deleted lines total, 7 of which are code lines whose trailing comment was removed; 9 blank separator lines went with their blocks).

Categories of noise removed

  • Section banners / visual separators (// ====...==== blocks in types.ts, session-form-atoms.ts)
  • Doc comments restating the symbol name (User message, Zod schema for StoredSession, Options for building a session config, …)
  • Field comments repeating names/types (// Message role, // Tool input parameters, // LLM model identifier, …)
  • @param / @returns restatements and usage @example narration (buildSessionConfig)
  • Control-flow narration (// Check dbSession first, // Prepend to existing sessions, // Convert DB's updated_at to milliseconds, // Completed successfully, …)
  • Narration of obvious fallthrough (// Default: regular text message)

Important comments intentionally retained

  • types.ts header: no-imports circular-dependency invariant; AgentMode sharing note; ts as unique message ID; text vs content "stream uses both"; say/ask subtype value domains; KilocodeEvent stdout passthrough; streamEventType discriminator rationale
  • session-config.ts: re-export compatibility note; sendMessageStream schema contract; field precedence notes
  • MessageContent.tsx: CLI-mimicking behavior note; "all fields except 'tool' are input parameters"; empty-output-means-complete semantics
  • db-session-atoms.ts: client-side-only warning and architecture header; high-water-mark staleness rules (incl. "don't use Math.max" and 2-second tolerance); org-context version >= 2 reliability rule; "CRITICAL" session-ID routing constraints; all catch-block intent comments
  • useOrganizationModels.ts: org access-policy note

Follow-up refactor candidates

  • getModeModelWithSource in session-config.ts partially duplicates buildSessionConfig precedence logic.
  • The two duplicated "update existing message" blocks in db-session-atoms.ts (processIncomingMessageAtom / appendMessageToSessionAtom).

Validation performed

  • oxfmt --check on all touched files: clean
  • pnpm run lint (apps/web oxlint): pass
  • pnpm run typecheck (apps/web tsgo): pass
  • Jest for the module: could not run — the suite's global setup requires a local Postgres, which this sandbox does not have (no Docker/binary); verified the failure is identical on the unmodified tree, and the diff is comment-only

Auto-merge: set to merge automatically on approval.

…-agent chat module

Delete section banners, restating doc blocks, field restatements, and
control-flow narration from the cloud-agent chat types, session config,
message rendering, and session store. Keep all constraint, contract, and
platform-behavior comments. Comment-only change.
@kilo-code-bot kilo-code-bot Bot added the janitor Automated dead-code/duplication cleanup label Oct 27, 2026
@kilo-code-bot
kilo-code-bot Bot enabled auto-merge October 27, 2026 08:05
@kilo-code-bot

kilo-code-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Comment-only cleanup of six apps/web/src/components/cloud-agent files: every removed line is a comment or blank separator, no executable code changed, and the load-bearing constraint comments (circular-dependency invariant, high-water-mark/staleness rules, org-context version >= 2 rule, session-ID routing constraints, sendMessageStream schema contract) are retained.

Assumptions: [INFERENCE] Jest could not be executed in this sandbox (global setup requires Postgres), but the diff contains no code changes, so no runtime behavior is affected.

Files Reviewed (6 files)
  • apps/web/src/components/cloud-agent/MessageContent.tsx
  • apps/web/src/components/cloud-agent/hooks/useOrganizationModels.ts
  • apps/web/src/components/cloud-agent/session-config.ts
  • apps/web/src/components/cloud-agent/store/db-session-atoms.ts
  • apps/web/src/components/cloud-agent/store/session-form-atoms.ts
  • apps/web/src/components/cloud-agent/types.ts

Reviewed by deepseek-flash-latest · Input: 46.9K · Output: 2.7K · Cached: 286K

Review guidance: REVIEW.md from base branch main

@kilo-code-bot

kilo-code-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Note on the failing web-test (1/8) / test checks — pre-existing on main, unrelated to this PR.

The 2 failures (slack/linear repository selection › preserves model-selected gitlab repositories) were introduced by #7874 (merged 9847a0e7fb), which added a validateGitLabRepoAccessForOrganization pre-check in spawn-cloud-agent-session.ts before the token fetch. apps/web/src/lib/bot/agent-runner.test.ts mocks @/lib/cloud-agent/gitlab-integration-helpers without that new function, so in those tests the call throws, the new fail-closed path returns an error, and getGitLabTokenForOrganization is never called (Number of calls: 0).

Evidence:

Suggested fix (for the #7874 author/maintainer): add validateGitLabRepoAccessForOrganization: jest.fn().mockResolvedValue(true) and validateGitLabRepoAccessForUser: jest.fn().mockResolvedValue(true) to the gitlab-integration-helpers mock factory in agent-runner.test.ts, mirroring that PR's own spawn-cloud-agent-session.test.ts mocks. Auto-merge here stays armed and will merge once main (or this branch) is green and the PR is approved.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

janitor Automated dead-code/duplication cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants