Skip to content

feat(scripts): add agent-sync bidirectional laptop/desk sync tooling - #266

Closed
KooshaPari wants to merge 2 commits into
masterfrom
wrapup/agent-sync-scripts-20261108
Closed

KooshaPari wants to merge 2 commits into
masterfrom
wrapup/agent-sync-scripts-20261108

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

User description

Adds 9 agent-sync scripts for bidirectional laptop/desk agent sync (commit abf61c4, +1292 lines).

Contents:

  • scripts/agent-sync - main bidirectional sync driver
  • scripts/agent-sync-config.toml - configuration
  • scripts/agent-sync-desk.sh, scripts/agent-sync-recovery.sh, scripts/agent-sync-verify.sh - desk, recovery and verification helpers
  • scripts/install-agent-sync.sh, scripts/install.sh - installers
  • scripts/com.phenotype.agent-sync.plist, scripts/scheduled-task.xml - macOS launchd and Windows scheduled task
  • scripts/fix-sshd-config.ps1 - Windows sshd configuration

Note: this branch is stacked on fix/opencode-go-responses-api, so the diff against master also carries the Responses API routing change. See the companion PR for that change in isolation.

tx-agent: jcode
tx-validated: manual

Tracks #271 (residual agent PR backlog): the Require Linked Issue gate failed only because this PR predates the issue.

Part of #271


CodeAnt-AI Description

Sync agent settings between laptop and desk automatically

What Changed

  • Syncs skills, memories, MCP settings, and other agent data between devices every five minutes.
  • Keeps device-specific configuration files out of automatic sync, with options to preview changes or choose a sync direction.
  • Adds tools to verify sync, restore desktop SSH access, and address a known SQLite vulnerability.

Impact

✅ Agent settings sync every five minutes
✅ Device-specific configs avoid automatic overwrites
✅ Known SQLite vulnerability addressed

💡 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.

Adds the agent-sync tooling that was sitting untracked in the working tree
and was never committed: the agent-sync driver, its config file, the
install/recovery/verify helpers, the macOS launchd plist, the Windows
scheduled-task XML, and a PowerShell sshd-config fixer.

tx-agent: jcode
tx-validated: manual
tx-task: wrapup-20261108
tx-scope: jcode-patch
tx-intent: Preserve the stranded agent-sync tooling that was never committed
Copilot AI balanced review requested due to automatic review settings November 8, 2026 07:55
@codeant-ai

codeant-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #692c4 Incremental review completed 63519b9 Nov 12, 2026 · 06:24 06:25
✅  #8f2ce Reviewed your PR abf61c4 Nov 08, 2026 · 07:55 08:06

@codeant-ai

codeant-ai Bot commented Nov 8, 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

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: fda25b2b-c568-4752-bf7e-c203ddbf4e27
Commits

Reviewing files that changed from the base of the PR and between 6ed8c06 and 63519b9.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 11

  • crates/jcode-base/Cargo.toml
  • crates/jcode-harness-api-server/Cargo.toml
  • scripts/agent-sync
  • scripts/agent-sync-config.toml
  • scripts/agent-sync-desk.sh
  • scripts/agent-sync-recovery.sh
  • scripts/agent-sync-verify.sh
  • scripts/com.phenotype.agent-sync.plist
  • scripts/fix-sshd-config.ps1
  • scripts/install-agent-sync.sh
  • scripts/scheduled-task.xml
Pre-merge checks: Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Description check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
  • 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

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Nov 8, 2026
Comment on lines +29 to +30
$bak = Join-Path $backupDir ("sshd_config.auto-restored-$stamp")
Copy-Item -Path $configPath -Destination $bak -Force

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: When the backups directory is absent, this copy fails under $ErrorActionPreference = 'Stop', aborting recovery before config cleanup and service restart.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/fix-sshd-config.ps1
**Line:** 29:30
**Comment:**
	*Logic Error: When the backups directory is absent, this copy fails under `$ErrorActionPreference = 'Stop'`, aborting recovery before config cleanup and service restart.

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
👍 | 👎

Comment on lines +33 to +34
$bak = Join-Path $backupDir ("sshd_config.pre-restore-$stamp")
Copy-Item -Path $configPath -Destination $bak -Force

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: This backup matches the next run’s sshd_config.* filter and is newer than the original, so rerunning restores pre-repair contents and can undo the intended backup restore.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/fix-sshd-config.ps1
**Line:** 33:34
**Comment:**
	*Logic Error: This backup matches the next run’s `sshd_config.*` filter and is newer than the original, so rerunning restores pre-repair contents and can undo the intended backup restore.

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
👍 | 👎

<Interval>PT5M</Interval>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2026-09-12T00:00:00</StartBoundary>

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: If installed before this fixed boundary, the five-minute trigger remains inactive until 12 September 2026, so only the boot trigger can sync meanwhile.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/scheduled-task.xml
**Line:** 14:14
**Comment:**
	*Logic Error: If installed before this fixed boundary, the five-minute trigger remains inactive until 12 September 2026, so only the boot trigger can sync meanwhile.

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
👍 | 👎

<Actions Context="Author">
<Exec>
<Command>wsl.exe</Command>
<Arguments>-d FedoraLinux-44 --exec /bin/bash -lc "/home/user/.local/bin/agent-sync --quiet"</Arguments>

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: On the desk, this uses the shared config’s desk peer instead of the laptop alias, so SSH targets the wrong host and scheduled reverse sync fails.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/scheduled-task.xml
**Line:** 46:46
**Comment:**
	*Logic Error: On the desk, this uses the shared config’s `desk` peer instead of the laptop alias, so SSH targets the wrong host and scheduled reverse sync fails.

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
👍 | 👎

Comment thread scripts/agent-sync
# - on WSL: REMOTE_HOME defaults to whatever the desk-side ssh config
# says (the laptop user), i.e. /Users/<laptop-user>.
#
# The user can override [path].remote_home in the config when needed.

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: This promises a [path].remote_home override, but the parser ignores keys in the [path] section, so that setting never affects remote path resolution.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Comment 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:** scripts/agent-sync
**Line:** 309:309
**Comment:**
	*Comment Mismatch: This promises a `[path].remote_home` override, but the parser ignores keys in the `[path]` section, so that setting never affects remote path resolution.

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
👍 | 👎

Comment thread scripts/agent-sync
resolve_local() {
local p="$1"
case "$p" in
"~"|"~/"*) p="$(printf '%s' "$p" | sed "s#^~/#$HOME/#; s#^~\$#$HOME#")" ;;

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: On WSL, configured ~/... local paths expand to /home/user/... here, not the Windows mount, so desk-side runs sync the wrong local tree.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Incorrect variable usage

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/agent-sync
**Line:** 314:314
**Comment:**
	*Incorrect Variable Usage: On WSL, configured `~/...` local paths expand to `/home/user/...` here, not the Windows mount, so desk-side runs sync the wrong local tree.

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
👍 | 👎

Comment thread scripts/agent-sync
fi

# Test SSH to peer (one connection, before the rsync loop) — skip if --init
if [[ $INIT_ONLY -eq 0 ]] && ! ssh "${SSH_OPTS[@]}" -o BatchMode=yes "$PEER" true 2>/dev/null; then

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: On the documented cmd.exe SSH shell, true is not a command, so this preflight fails and exits before any sync starts.

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:** scripts/agent-sync
**Line:** 410:410
**Comment:**
	*Api Mismatch: On the documented `cmd.exe` SSH shell, `true` is not a command, so this preflight fails and exits before any sync starts.

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
👍 | 👎

Comment thread scripts/agent-sync
# -z compress over the wire
# -h human-readable numbers
# -P keep partial + show progress
RSYNC_BASE=(-a -t -u --delete -i -z)

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: In a bidirectional run, this local-to-remote pass deletes desk-only files before the later pull can retrieve them, causing permanent loss of remote additions.

Assessment: 🔴 Critical · 🔁 Occurrence: Sometimes · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/agent-sync
**Line:** 424:424
**Comment:**
	*Logic Error: In a bidirectional run, this local-to-remote pass deletes desk-only files before the later pull can retrieve them, causing permanent loss of remote additions.

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
👍 | 👎

Comment thread scripts/agent-sync

# For a single-file path, rsync wants the parent dir + filename.
local src_mode="dir"
if [[ -f "$ll" ]]; then

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: If a configured single-file target is absent locally, this defaults to directory mode; pulls then use a trailing slash and fail, while --init creates a directory at the file path.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Incorrect condition logic

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/agent-sync
**Line:** 450:450
**Comment:**
	*Incorrect Condition Logic: If a configured single-file target is absent locally, this defaults to directory mode; pulls then use a trailing slash and fail, while `--init` creates a directory at the file path.

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
👍 | 👎

Comment thread scripts/agent-sync
"${cmd[@]}" --dry-run 2>&1 | tee -a "$LOG_FILE" >/dev/null || {
err "[$name] push failed"; FAIL=$((FAIL+1)); FAILED_NAMES+=("$name"); return 1; }
else
"${cmd[@]}" 2>&1 | tee -a "$LOG_FILE" >/dev/null || {

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: Without pipefail, tee's success hides a failed rsync status; the function then counts the unsuccessful transfer as successful.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/agent-sync
**Line:** 482:482
**Comment:**
	*Logic Error: Without `pipefail`, `tee`'s success hides a failed rsync status; the function then counts the unsuccessful transfer as successful.

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
👍 | 👎

Comment thread scripts/agent-sync
# Iterate targets via python (cleaner than bash loop over JSON)
TMPF=$(mktemp)
printf '%s' "$TARGETS_JSON" > "$TMPF"
AGENT_SYNC_TARGETS="$TMPF" python3 << 'PYEOF' | while IFS=$'\t' read -r name lp rp; do

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: This while runs in a pipeline subshell, so its OK and FAIL updates disappear; the parent writes zero counts and exits successfully even when failures are detected.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/agent-sync
**Line:** 512:512
**Comment:**
	*Logic Error: This `while` runs in a pipeline subshell, so its `OK` and `FAIL` updates disappear; the parent writes zero counts and exits successfully even when failures are detected.

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
👍 | 👎

#
# Leave empty to fall back to using `~/.foo` literally in the rsync URL
# (works if the peer's shell expands ~ to its $HOME for you).
remote_home = "/mnt/c/Users/koosh"

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: On WSL this shared value makes remote ~ paths point to the desk's Windows profile, not the laptop user's home, so peer paths are wrong.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Incorrect variable usage

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

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

**Path:** scripts/agent-sync-config.toml
**Line:** 42:42
**Comment:**
	*Incorrect Variable Usage: On WSL this shared value makes remote `~` paths point to the desk's Windows profile, not the laptop user's home, so peer paths are wrong.

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 Nov 8, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Nitpicks

3 code suggestions

1. This applies only global excludes and drops each target's excludes; Forge session snap-*.db files are copied despite their explicit exclusion.

Incomplete implementation · scripts/agent-sync:430


2. This only prints a PASS message; it never writes REMOTE_PATH2 on the desk, so the presence check fails and the pull test never runs.

Incomplete implementation · scripts/agent-sync-verify.sh:217


3. The warning says this branch rewrites DefaultShell to PowerShell, but the later cleanup removes the directive; SSH is not configured to use PowerShell.

Comment mismatch · scripts/fix-sshd-config.ps1:28

@codeant-ai

codeant-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt PR Risk

🔴  High Risk

  • The PR should not merge yet; bidirectional sync can permanently delete files that exist only on the desk before the pull pass retrieves them.
  • Failed rsync commands can be reported as successful because tee masks their exit status, and the loop's subshell discards failure counts.
  • The scheduled desk task uses the shared default peer instead of the laptop alias, so scheduled reverse sync may target the wrong host.

Assessed commit: 63519b9457dd

set -u

CONFIG_PATH="${AGENT_SYNC_CONFIG:-$HOME/.config/agent-sync/config.toml}"
exec /usr/bin/env bash /home/user/.local/bin/agent-sync \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CRITICAL: agent-sync does not accept a --peer long option (it uses -p PEER). This wrapper will exit with unknown option: --peer (exit 64), so the desk-side scheduled sync never runs.

Suggested change
exec /usr/bin/env bash /home/user/.local/bin/agent-sync \
exec /usr/bin/env bash /home/user/.local/bin/agent-sync \
-p kooshas-laptop-ts --quiet "$@"

# -----------------------------------------------------------------------------
TESTFILE2="test-from-desk-$(date +%Y%m%d%H%M%S).txt"
REMOTE_PATH2="$DESK_WIN_HOME/.jcode/skills/$TESTFILE2"
pass "wrote $REMOTE_PATH2 on desk"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: Section 7 claims the desk test file was written but never creates REMOTE_PATH2 on the desk. The subsequent presence check (line ~220) will fail, so the pull-direction verification cannot pass as written. Create the file on the desk (e.g. via ssh .../WSL) before checking/pulling it.

== post-restore (run AFTER SSH to desk is back) ==

# 1. From laptop: push jcode first (only on laptop), then enable bidir
agent-sync --push-only jcode-skills jcode-memory jcode-mcp jcode-agents

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: Post-restore examples reference target names that don't exist in scripts/agent-sync-config.toml (jcode-agents, codex-agents, forge-agents). The config defines jcode-memory/jcode-memories, codex-agents-md/codex-memories, forge-agents-md, etc. These commands will not sync the intended data and may confuse operators during recovery.

@kilo-code-bot

kilo-code-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 15 Issues Found | Recommendation: Request Changes

Incremental review (HEAD 63519b945 vs baseline abf61c480)

Changed files: Cargo.lock, crates/jcode-base/Cargo.toml, crates/jcode-harness-api-server/Cargo.toml — rusqlite 0.32 → 0.41 security bump (clears RUSTSEC-2026-0459). No Rust source changed; usage in both crates is stable core API (Connection::open, OpenFlags, params, OptionalExtension) and the lockfile is consistent (new transitive rsqlite-vfs/sqlite-wasm-rs, libsqlite3-sys 0.39.1, thiserror 2.0.21). No new issues found. All agent-sync script files are unchanged since baseline, so prior findings below remain unresolved.

Fix these issues in Kilo Cloud

Overview

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

CRITICAL

File Line Issue
scripts/agent-sync-desk.sh 13 --peer unsupported; agent-sync expects -p PEER, so desk scheduled sync exits 64.
scripts/agent-sync 424 Bidirectional local→remote pass uses --delete before the later pull, risking permanent loss of desk-only additions.

WARNING

File Line Issue
scripts/agent-sync-verify.sh 217 Section 7 never creates REMOTE_PATH2 on the desk before checking/pulling it.
scripts/install-agent-sync.sh 44 Post-restore examples reference non-existent targets (jcode-agents, codex-agents, forge-agents).
scripts/agent-sync 309 [path].remote_home override documented but parser ignores [path] section keys.
scripts/agent-sync 314 WSL ~/ expansion points to Linux home, not Windows mount; desk syncs wrong local tree.
scripts/agent-sync 410 SSH preflight runs true, which is not a cmd.exe command.
scripts/agent-sync 450 Absent single-file target defaults to directory mode; pulls with trailing slash fail.
scripts/agent-sync 482 rsync | tee without pipefail masks failed transfers.
scripts/agent-sync 512 Target-loop while runs in pipeline subshell; OK/FAIL counts lost.
scripts/agent-sync-config.toml 42 Shared remote_home makes WSL remote ~ point to desk's Windows profile.
scripts/fix-sshd-config.ps1 30 Absent backups dir aborts recovery under $ErrorActionPreference = 'Stop'.
scripts/fix-sshd-config.ps1 34 New backup matches sshd_config.* filter; rerun can undo intended restore.
scripts/scheduled-task.xml 14 Fixed StartBoundary is in the past; 5-min trigger inactive until 2026-09-12.
scripts/scheduled-task.xml 46 Desk scheduled task uses desk peer instead of laptop alias; SSH targets wrong host.
Files Reviewed (3 files in this incremental pass)
  • Cargo.lock — no new issues
  • crates/jcode-base/Cargo.toml — no new issues
  • crates/jcode-harness-api-server/Cargo.toml — no new issues
Previous Review Summary (commit abf61c4)

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

Previous review (commit abf61c4)

Status: Issues Found (desk-side sync/wrapper broken; verify script incomplete) | Recommendation: Request Changes

Overview

Severity Count
CRITICAL 1
WARNING 2
Existing (CodeAnt, unresolved on changed lines) 12+

Review scope: PR #266 diff (9 new scripts/* files, abf61c480…). Read-only analysis; no commands executed beyond gh reads. Other gh commands (e.g. gh pr review) were not used per sandbox policy. PR is stacked on another branch per description — findings limited to files/lines changed in this PR.

New Issues (posted inline by this review)

CRITICAL

File Line Issue
scripts/agent-sync-desk.sh 13 Uses --peer (unsupported by scripts/agent-sync; expects -p). Desk scheduled sync will fail with exit 64.

WARNING

File Line Issue
scripts/agent-sync-verify.sh 217 Section 7 never creates REMOTE_PATH2 on the desk before checking/pulling; desk→laptop verification path is incomplete as written.
scripts/install-agent-sync.sh 44 Post-restore examples reference non-existent target names (jcode-agents, codex-agents, forge-agents); config defines jcode-memory/memories, codex-agents-md/memories, forge-agents-md, etc.

Existing Inline Findings (CodeAnt, still present on current diff)

CodeAnt has active inline comments on changed lines (not duplicated here) covering high-impact issues in scripts/agent-sync and related files, including:

  • Data-loss risk: bidirectional push uses --delete before pull (scripts/agent-sync ~424) — can delete remote-only additions.
  • Failure masking: rsync | tee without pipefail and subshell counter updates in the target loop (~482, ~512) can report success on failure / lose counts.
  • Desk/WSL path & peer handling: resolve_local ~ expansion on WSL, remote_home config/override mismatch, --status resolve behavior, SSH preflight using true vs cmd.exe shell (~309, ~314, ~410).
  • Single-file target mode detection when local file absent (~450); per-target excludes not applied (global only, ~430) — affects forge-sessions snap excludes.
  • PowerShell recovery: missing backup dir handling / backup naming can break recovery or undo restore (scripts/fix-sshd-config.ps1 ~29-34).
  • Windows task: fixed StartBoundary in past + peer/args on desk (scripts/scheduled-task.xml ~14, ~46).

Please reconcile CodeAnt inline threads and verify fixes against current HEAD before merge.

Files Reviewed (9 files)
  • scripts/agent-sync — issues noted (existing CodeAnt threads + logic risks reviewed)
  • scripts/agent-sync-config.toml — config/path semantics noted
  • scripts/agent-sync-desk.sh — CRITICAL (inline)
  • scripts/agent-sync-recovery.sh — reviewed
  • scripts/agent-sync-verify.sh — WARNING (inline)
  • scripts/com.phenotype.agent-sync.plist — reviewed (templated paths)
  • scripts/fix-sshd-config.ps1 — existing CodeAnt issues noted
  • scripts/install-agent-sync.sh — WARNING (inline)
  • scripts/scheduled-task.xml — existing CodeAnt issues noted

Fix these issues in Kilo Cloud


Reviewed by free · Input: 81.2K · Output: 20K · Cached: 134.4K

libsqlite3-sys 0.30.1 is affected by RUSTSEC-2026-0459 (C SQLite
CVE-2026-119375, severity 6.8, fixed in libsqlite3-sys >= 0.39.0). The
`Security preflight (Linux)` job fails on it because the advisory is not
in the script's ignore list.

Dependency chain, before this change:

    libsqlite3-sys v0.30.1
    └── rusqlite v0.32.1
        ├── jcode-base
        └── jcode-harness-api-server

The vulnerable version cannot be moved directly: rusqlite 0.32.1 pins
libsqlite3-sys "^0.30.1", so `cargo update -p libsqlite3-sys --precise
0.39.0` fails with "failed to select a version for the requirement
`libsqlite3-sys = ^0.30.1`".

Each rusqlite 0.x minor advances libsqlite3-sys by exactly one minor, so
rusqlite 0.41.x is the first release reaching libsqlite3-sys ^0.39.0.
Bump the parent to 0.41 in the two workspace members that declare it and
update the lockfile: libsqlite3-sys 0.30.1 -> 0.39.1, rusqlite 0.32.1 ->
0.41.1.

No --ignore is added for RUSTSEC-2026-0459. The advisory is fixed by a
real upgrade, not suppressed.

The rusqlite API surface used by this repo (Connection::open, execute,
prepare, query_row, params!, OptionalExtension) is unchanged across
0.32 -> 0.41.

tx-agent: jcode
tx-validated: cargo-check
tx-task: RUSTSEC-2026-0459
tx-scope: jcode-base,jcode-harness-api-server
tx-intent: Replace vulnerable libsqlite3-sys 0.30.1 with a real upgrade to 0.39.1 via its parent rusqlite, so the security preflight gate stops failing on RUSTSEC-2026-0459
tx-lane: wJ:p7
@sonarqubecloud

Copy link
Copy Markdown

KooshaPari added a commit that referenced this pull request Nov 12, 2026
…266)

The sync tooling existed only on the wrapup branch and had gone stale against
master: the two conflict hunks (Cargo.lock, harness-api-server manifest) were
spurious - both sides already carried rusqlite 0.41 and the same tokio feature
set - so the resolution keeps master's manifests verbatim. The real payload is
nine scripts under scripts/: the sync driver, its config, the desk side, a
recovery path, a verifier, the launchd plist, the Windows Task Scheduler XML,
the installer, and an sshd config fixer.

tx-agent: jcode
tx-validated: none
tx-scope: scripts/
tx-intent: get PR #266 off disk and into master without touching Rust code
tx-lane: wJ:p7
@KooshaPari KooshaPari closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants