Server CLI acts wrongly when the config is tailnet-only, uses another port, or names another owner #675
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#675
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The owner-aware server CLI misbehaves outside the default single-user loopback setup: it probes without the loopback check, registers with the wrong port, reports the wrong PID, erases a bad config silently, prints a hint that ignores HOME, and prints server-supplied text unfiltered.
Found during IW-652 (per-user dashboard, service links, Claude session links). Follow-ups, verbatim:
ServerConfigRepository.getOrCreateDefault(core/adapters/ServerConfigRepository.scala:52-59) writes the default config over aconfig.jsonthat fails parsing or validation, so a bad edit is erased without a word.ServerClientlazy spawn andiw dashboard(core/commands/Dashboard.scala:133) probelocalhostwithout the loopback check that IW-652 Phase 1 adds toiw server runandiw server start; with a tailnet-only config they start a server and then report it as failed.ServerClient.registerWorktree(dashboard/jvm/src/infrastructure/CaskServer.scala:1394), which takes the port fromIW_SERVER_PORTorconfig.jsonand not from the server's own port; a server started on another port registers with the wrong server, or is refused by the owner check.iw server statusprints this user's live PID next to whatever server answers the port, also when/api/statusnames another owner (core/commands/Server.scalashowStatus/reportStatus).~/.local/share/iw/server/config.jsonis a literal incore/model/ServerOwnership.scalaand in thestartexit-code text, whileServer.configPathfollowsHOME; the hint is wrong when the data directory moves./api/statusand non-JSON error bodies from the server are printed to the terminal unfiltered (ServerOwnership.refusal,Server.scalastatus lines,ServerClient.scalaerror mapping); strip control characters or validate the owner as a login name inServerStatus.readReply.Intake: needs-human
Workflow: diagnostic
Reason: G5 — 6 phases (also: a refused correction stands — the Defect 4 fix would print "not the server on port" for an owner-unknown server, including your own; see Review Notes)
Analysis: project-management/issues/IW-675/analysis.md on branch IW-675
Intake: needs-input
Workflow: diagnostic
Reason: G5 (6 phases); G7 (1 standing correction of the analysis review)
Analysis: project-management/issues/IW-675/analysis.md on branch IW-675
ServerOwnershipdecidesUnknown(core/model/ServerOwnership.scala:20-24).Unknownmeans only that the server reports no owner, or that iw cannot read the own user; it does not show that the process is another server. Your live server reports "Owner: unknown" (analysis.md:172), so after the fixiw server statuswould tell you that your own server is not yours, and would also stop printingPID:until the server restarts on a newer build. The reviewer and the corrector agree that theUnknownline must not say "not the server on port"; the corrector refused the reviewer's one wording because it is false when the own user is unreadable. What shouldiw server statusprint onUnknown? Options: a) one line per cause: "the server on port reports no owner, so iw cannot tell whether it is process " when the server reports none, and "iw cannot read your user, so it cannot tell whether the server on port is process " when the own user is unreadable; keep printingPID:onUnknownb) one neutral line for both causes: "iw cannot tell whether the server on port is process ", and keepPID:c) print no ownership line and noPID:onUnknownRecommended: a)tasks.mdhas 6 phases; an unattended issue holds at most 3. The answer is usually to split the issue, not to raise the bar. The phase index falls into two chains: phases 1-3 — a config that fails parsing is erased without a word (2-4 h), the lazy spawn andiw dashboardstart a server the CLI cannot reach (3-5 h), a worktree made in the browser is registered with the serverconfig.jsonnames (3-5 h); each needs the one before. Phases 4-6 — the config path hint ignores where the config is read from (1-2 h), server text reaches the terminal with control characters (2-3 h),iw server statusprints this user's PID next to another user's server (2-3 h); phase 5 must come before phase 6. How should IW-675 be split? Options: a) IW-675 keeps phases 1-3, and a new issue takes phases 4-6 (Defects 5, 6 and 4) b) three issues of two phases each: 1-2, 3-4, 5-6 c) run all 6 phases as one issue Recommended: a)Answer in a comment on this issue; intake reads it on its next iteration.