Skip to content

fix: Windows console-flash — CREATE_NO_WINDOW on daemon/gateway/git-shim/jobs spawns - #407

Merged
getappz merged 3 commits into
masterfrom
task/427
Aug 8, 2026
Merged

fix: Windows console-flash — CREATE_NO_WINDOW on daemon/gateway/git-shim/jobs spawns#407
getappz merged 3 commits into
masterfrom
task/427

Conversation

@getappz

@getappz getappz commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Several hot-path Command::new spawns on Windows never set CREATE_NO_WINDOW. Since the spawning processes (the agentflare daemon, gateway-registry backend connections) are themselves console-less, Windows auto-allocates a fresh console window for every console-subsystem child spawned without it -- visible as a brief flash.
  • Fixed 4 spawn sites:
    • gateway-registry::ensure_connected -- downstream MCP backend respawns on circuit-breaker/timeout
    • flare-git-shim::scope_check_deny_reason -- runs on every git command through the shim
    • ipc::process.rs -- is_alive/terminate_gracefully/force_kill/list_pids_raw (tasklist/taskkill), backing daemon lifecycle
    • agentflare-jobs::Supervisor::spawn/kill_graceful -- dispatched by the daemon's own background discovery tick every 12s (spawn_supervisor_discovery), independent of any active session -- the one most likely to explain flashes with no Claude Code session open at all

Test plan

  • cargo build (full workspace) -- succeeds
  • cargo clippy -p agentflare-gateway-registry -p flare-git-shim --all-features -- -D warnings -A unsafe_code -A clippy::pedantic -- clean
  • cargo build -p agentflare-jobs -- clean (only pre-existing unrelated dead_code warning)
  • cargo test -p agentflare --bin agentflare ipc::process -- 4/4 passed
  • cargo test -p flare-git-shim -- 16/16 passed
  • Live-verified: built + installed via agentflare dev-install, restarted the daemon onto the new binary, confirmed binary mtime/size changed (not just trusting dev-install's own "ok installed" claim, which has a known false-positive bug)

Summary by CodeRabbit

  • Bug Fixes

    • Prevented unwanted console windows from appearing during background process execution on Windows.
    • Applied this improvement to job management, scope checks, MCP backends, Git operations, and process monitoring or termination.
    • Existing command behavior and error handling remain unchanged.
  • Performance

    • Improved repeated repository-root lookups by caching previously resolved results.

…-shim/jobs spawns

Several hot-path Command::new spawns lacked the Windows CREATE_NO_WINDOW
creation flag. Since the spawning processes (the agentflare daemon,
gateway-registry backend connections) are themselves console-less,
Windows auto-allocates a fresh console window for every console-subsystem
child spawned without this flag -- visible as a brief flash.

Fixed spawn sites:
- gateway-registry::ensure_connected -- downstream MCP backend respawns
  on circuit-breaker/timeout
- flare-git-shim::scope_check_deny_reason -- runs on every git command
  through the shim
- ipc::process.rs -- is_alive/terminate_gracefully/force_kill/
  list_pids_raw (tasklist/taskkill), backing daemon lifecycle
- agentflare-jobs::Supervisor::spawn/kill_graceful -- dispatched by the
  daemon's own background discovery tick every 12s, independent of any
  active session, so this is the one most likely to explain flashes with
  no Claude Code session open at all
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Windows subprocess launches and process-management commands now use CREATE_NO_WINDOW. Git execution applies the same Windows configuration. Repository-root lookups now cache results by current working directory.

Changes

Windows process visibility and repository resolution

Layer / File(s) Summary
Background process commands
crates/agentflare-jobs/src/supervisor.rs, crates/gateway-registry/src/mcp_stdio.rs, crates/flare-git-shim/src/main.rs, crates/flare-git-core/src/shell.rs
Windows job, MCP backend, Git scope-check, and Git shell subprocesses now apply CREATE_NO_WINDOW.
Process lifecycle commands
src/ipc/process.rs, crates/agentflare-jobs/src/supervisor.rs
Windows tasklist and taskkill commands now apply CREATE_NO_WINDOW for process checks and termination operations.
Repository-root cache
src/mcp_server.rs
repo_root caches resolved roots by current working directory and bypasses cache access when the mutex cannot be acquired.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly identifies the main Windows console-flash fix and the affected process spawns.
Description check ✅ Passed The description provides a clear summary and detailed test results, but it omits the template's Notes for reviewers section.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/427

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

getappz added 2 commits August 8, 2026 19:01
…dundant spawns

flare-git-core::shell::run_in/diff -- the shared git-execution primitive
nearly everything in this crate goes through -- lacked CREATE_NO_WINDOW.
Live-caught: the daemon was spawning 'git rev-parse --show-toplevel'
via this path on essentially every project/item MCP call.

AgentflareMcp::repo_root() now memoizes its result per-cwd instead of
re-spawning git on every single call, cutting the actual spawn count
(not just hiding the window). Keyed by cwd rather than a single cached
value because cli::work::execute_work calls set_current_dir to switch
into an item's worktree for in-process work-item execution -- a
single-value cache would freeze on whatever cwd resolved first and
silently break resolution for every worktree after that.
@getappz getappz changed the title Fix Windows console-flash: CREATE_NO_WINDOW on daemon/gateway/git-shim/jobs spawns fix: Windows console-flash — CREATE_NO_WINDOW on daemon/gateway/git-shim/jobs spawns Aug 8, 2026
@getappz
getappz merged commit 1ad7d49 into master Aug 8, 2026
17 checks passed
@getappz
getappz deleted the task/427 branch August 8, 2026 14:18
getappz added a commit that referenced this pull request Aug 13, 2026
…y exec (#477)

run_real is the shared PATH-shim passthrough every installed shim (agentflare-shim's generic cat/python/which/etc dispatch and flare-git-shim's final passthrough) funnels through on every invocation. PR #407 added CREATE_NO_WINDOW to 5 other spawn sites but missed this one, which dominates actual shim usage.

Mirrors the no_console_window helper already used in flare-git-core::shell.rs. creation_flags only suppresses the auto-allocated console; .status()'s default stdio inheritance is untouched, so interactive passthrough is unaffected.

Agentflare-Agent: claude-code
Agentflare-Branch: task/464-windows-console-flash-agentflare-shim-s
Agentflare-Item: 464
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