Skip to content

killAgent() is a no-op — sidebar agent subprocess not terminated on kill/stop #669

@mr-k-man

Description

@mr-k-man

Summary

killAgent() in browse/src/server.ts:471 signals agentProcess, but agentProcess is never assigned after the queue-based refactor. spawnClaude() writes to sidebar-agent-queue.jsonl instead of spawning directly. The /sidebar-agent/kill and /sidebar-agent/stop endpoints reset local state (status, timestamps) but the actual claude subprocess in sidebar-agent.ts keeps running.

Impact

Users clicking "Stop" in the sidebar UI see the agent marked as stopped, but the real claude process continues executing — consuming API tokens and potentially making changes.

Fix

PR #664 adds a cancel-file protocol: killAgent() writes a cancel file, sidebar-agent.ts polls for it every 500ms during active processing, and kills the subprocess on detection.

Found via sqry AST-based semantic code graph analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions