Skip to content

Releases: Alexli18/claude-king

v0.2.5

Choose a tag to compare

@github-actions github-actions released this 05 Apr 16:06

Changelog

  • e6c1da4 fix(daemon): robust orphan kill — pid:pgid file, sigkill, deferred deletion

v0.2.4

Choose a tag to compare

@Alexli18 Alexli18 released this 05 Apr 15:33

Bug Fixes

Bug 1: `king down` never fully stopped the daemon

Root cause: Deadlock between `Stop()` and the `king down` client:

  • `handleConnection` goroutines are counted in `d.wg` and block on `scanner.Scan()`
  • `king down` keeps the connection open while polling for the socket to disappear (5s timeout)
  • `Stop()` called `d.wg.Wait()` before closing active connections
  • Result: daemon waited for connection close, `king down` waited for socket, socket waited for `wg.Wait()`

Fix: Track all active RPC connections in `activeConns` map. `Stop()` closes all connections before `d.wg.Wait()`, unblocking `handleConnection` goroutines immediately.


Bug 2: Vassal processes accumulated on each reconnect

Root cause: When `king mcp` is killed (SIGKILL — e.g. by Claude Code on session restart), child vassal processes are reparented to `init` and become orphaned. Next `king mcp` run finds `IsRunning()=false` (dead PID) and calls `Start()`, launching N new vassals on top of N orphaned ones. The existing kill-on-relaunch guard in `launchAIVassal` only checked `d.vassalProcs`, which is empty in a fresh start.

Fix: Per-vassal PID files at `.king/vassals/.pid`. On each `launchAIVassal` call, the old PID is read and the process group is sent SIGTERM before the new process starts. On graceful `Stop()`, PID files are removed.

v0.2.3

Choose a tag to compare

@Alexli18 Alexli18 released this 05 Apr 14:26

Bug Fix

Vassal process leak on king mcp reconnect (#critical)

Root Cause

king mcp calls Attach() when a daemon is already running (via king up --detach).
On exit, Stop() unconditionally deleted the daemon's socket file and PID file — files
that belong to the background daemon, not to the king mcp MCP gateway process.

On the next reconnect:

  1. IsRunning() found no PID file → returned false
  2. Start() succeeded and launched N new vassal processes
  3. Old daemon kept running with its N vassal processes
  4. Net result: +N leaked processes per reconnect

Fix

Added attachMode bool flag set in Attach(). In Stop(), socket/PID file removal
is skipped when attachMode is true — these files belong to the daemon process and
must remain intact across king mcp reconnect cycles.

v0.2.2 — Async Gateway Task Cache

Choose a tag to compare

@Alexli18 Alexli18 released this 05 Apr 14:06

What's New

Async Gateway Task Cache

The King MCP gateway now handles dispatch_task, get_task_status, and abort_task without blocking:

  • dispatch_task returns immediately with a gt-* task ID — no waiting for vassal response
  • get_task_status reads from local SQLite cache — no round-trip to vassal for completed tasks
  • abort_task updates status immediately — async best-effort cancel delivered to vassal
  • Background reconciler polls active tasks every 10s to keep status fresh
  • Backward compatible: t-* vassal task IDs still proxied directly

Bug Fixes

  • Vassal process leak: kills existing process before launching new one on daemon restart
  • Empty task output: switched Claude CLI to --output-format json with proper fallbacks
  • Hung log spam: hang detection fires once per idle period (not every 5 min), disabled by default for shell vassals
  • kingctl report-done: added --king-dir flag + auto-discovery by walking directory tree
  • register_artifact FK error: correctly resolves producer vassal name → UUID
  • Shell vassal visibility in attach mode: RPC PTY proxy with retry logic
  • king-vassal stdio mode: --stdio flag for direct MCP over stdin/stdout (no socket)

SQLite Migration

Migration v3 runs automatically on king up — adds gateway_tasks table.

v0.2.1

Choose a tag to compare

@github-actions github-actions released this 04 Apr 19:03

Changelog

  • 32a57dc test: raise unit test coverage to ≥80% across all packages
  • 6825ac4 fix: resolve race condition and health script timeout hang in CI
  • 596d120 fix(pty): use /bin/sh instead of /bin/bash in TestSession_GetOutput_AfterCommand
  • 56855f9 fix(pty): skip TestSession_GetOutput_AfterCommand when PTY unavailable
  • a248401 fix(pty): add GetPID() accessor to eliminate data race on Session.PID
  • 3ea3725 feat(webhook): add async Dispatcher with HMAC signing and retry
  • a4b59d5 feat(daemon): wire webhook dispatcher to sieve and guard circuit events
  • 718f748 feat(config): add WebhookConfig to Settings
  • 6028312 feat(cli): add 'king webhook test ' command

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 04 Apr 13:00

Changelog

  • b840db4 feat(vassal): replace model string with AIExecutor in VassalServer
  • 80129c8 feat(vassal): add GeminiExecutor with VASSAL.md prompt injection
  • 3616a2d feat(vassal): add CodexExecutor
  • 1841ded feat(vassal): add ClaudeExecutor
  • ed88a6d feat(vassal): add AIExecutor interface and NewExecutor factory
  • d37f36f feat(mcp): expose specialization and correct type in list_vassals
  • 9496d8f feat(king-vassal): add --executor flag for AI type selection
  • e00f7b3 feat(daemon): generalize launchClaudeVassal → launchAIVassal for codex/gemini support
  • a3022ef feat(config): add codex/gemini vassal types and Specialization field
  • 10f000f Revert "docs: add multi-AI vassal support design doc"

v0.1.1

Choose a tag to compare

@Alexli18 Alexli18 released this 04 Apr 12:20

What's Changed

Bug Fixes

  • VassalClient: Add 60s default read deadline to prevent indefinite hangs when vassal process is stuck (internal/daemon/vassal_client.go)
  • PTY Manager: Log DB errors on critical paths (CreateSession, monitorSession) instead of silently discarding them (internal/pty/manager.go)
  • king-vassal: Log vassal registration errors (connection and RPC) instead of silently dropping them (cmd/king-vassal/main.go)

Chores

  • Clean up non-standard TODO(permission) comments to standard Go NOTE: format in MCP server (internal/mcp/server.go)

Full Changelog: v0.1.0...v0.1.1

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 03 Apr 22:30

Changelog

  • 5ae4757 test: smoke test T11 — all binaries build and kingctl report-done works
  • 319f10b test(daemon): use exact-match assertions in serial expansion tests
  • 7e6a28e test(daemon): add no-op release subtest, 7 subtests total
  • b48d382 style(fingerprint): move ProjectTypeUnknown to end of const block
  • 0c4ba45 style(config): capture BaudRateOrDefault result before fatalf
  • 9689b75 fix: value receiver on TypeOrDefault, omitempty on new VassalConfig fields
  • b712677 fix: skip claude-type vassals in startVassals to prevent orphan PTY sessions
  • 22e6839 fix: remove redundant newline in king doctor println
  • 9c24848 fix: goreleaser release target, remove tidy hook, fix changelog sort
  • 58cd5d7 fix: foreground king up now exits on king down; reject unknown flags
  • aa4c424 fix: close vassal client in loop, sanitise register inputs, sort vassal.list output
  • 2d34619 fix: capture pid before Process.Release() to avoid -1 on macOS/Linux
  • 70aef5a fix: address race conditions and robustness issues in runTask
  • 87563ed fix: address code review issues in vassal task and context files
  • 13c866c fix: address code review issues in cmdUpDetach
  • bb9e016 fix: address code review issues in cmdUp flag parsing
  • c1253fb fix: address code review issues in VassalServer — single connection, race fixes, cleanup
  • 53e6ac8 fix: address code review findings — doctor checks, CI kingctl, install.sh dedup, Makefile PATH escaping
  • d7372d0 fix: address code quality issues in VassalServer (sync.Once, loadErr warn)
  • 755ab8b fix: add king version var + --version cmd, remove toolchain directive from go.mod
  • ba6d3bc fix(registry): add nil guard in Unregister, add cross-process flock
  • aafe8eb fix(mcp): use RequireString for vassal param, push source filter to DB
  • 0fe612d fix(mcp): stop heartbeat goroutine on release, log re-delegation failures
  • 2600dfe fix(mcp): clarify exec_in description — only for PTY vassals, not claude type
  • 518e8c1 fix(logs): emit VASSAL_FAILED on abnormal exit, add reason-code assertions
  • 30c66e9 fix(discovery): improve type safety and test coverage for FindAllKingdomSockets
  • 0d472fc fix(daemon): use timeNow() shim in wardenTick for clock control
  • 91958f9 fix(daemon): use stty -f on macOS, allow empty command for type:serial
  • 9474798 fix(daemon): remove unused pidFileName/sockFileName constants, fix comment style
  • b24cfe9 fix(daemon): remove duplicate vassal.register/vassal.list handler registration
  • f32fdc7 fix(daemon): protect map reads in delegation test, add no-op release test
  • bdfa80b fix(daemon): move liveness check outside lock, validate PID in vassal.register
  • 9516dff fix(cmd): register foreground daemon in registry, wait for shutdown before unregister
  • cb4fc97 fix(cmd): fix vassal error message, use defer close, sort kingdoms in king list
  • ee24f7a fix(artifacts): log SCANNER_TIMEOUT on external scanner timeout
  • 609e508 fix
  • d0fb3bf feat: vassal-as-claude-agent — bidirectional MCP with king-vassal sidecar
  • f88d043 feat: launch king-vassal subprocess for claude-type vassals
  • cbc6dca feat: king-vassal zero-config mode — auto-discover socket, name from cwd
  • 1ccd0bd feat: integrate secret scanner into Ledger.Register — blocks INVALID_SECURITY artifacts
  • cc8ea6d feat: implement runTask — launches claude headless with VASSAL.md context
  • 14717d5 feat: implement king up --detach via re-exec with Setsid
  • 039450e feat: daemon auto-integrity — inject go-vet/eslint/npm-test contracts on vassal registration
  • 34ae1ac feat: add vassal task state structs, file helpers, and VASSAL.md generator
  • 1798f09 feat: add kingctl report-done subcommand
  • d5adab5 feat: add king-vassal binary with dispatch_task, get_task_status, abort_task MCP tools
  • 7a7dd24 feat: add king doctor health check command
  • cc34ed5 feat: add internal/security — secret scanner with filename blacklist and content regex
  • 38b6761 feat: add internal/fingerprint — project type detection (Go/Node/Hardware)
  • 66f2fac feat: add internal/discovery — git-style kingdom socket traversal
  • 3c0969c feat: add install.sh with automatic PATH patching
  • 7685335 feat: add fingerprint.DefaultContracts — auto-integrity patterns per project type
  • f0c71c4 feat: add dispatch_task/get_task_status/abort_task MCP tools to King
  • 9a9d180 feat: add demo GIF recorded with live Claude Code + King session
  • e7702cc feat: add VassalClientPool for King daemon to call vassal MCP tools
  • feb0ebf feat: add VassalClientPool for King daemon to call vassal MCP tools
  • 4e773bd feat: add Type, Host, SSHUser fields to VassalConfig
  • f3ae05a feat: add GoReleaser config for prebuilt binary releases
  • 11ebddd feat: add --detach/--daemon flag parsing to cmdUp
  • 93da7fd feat(vassal): multi-kingdom discovery, interactive selection, and self-registration with King
  • 693172b feat(vassal): add StartStdio method for Claude Code MCP integration
  • 61848dc feat(registry): add P2P registry with atomic file I/O and PID pruning
  • ee661e1 feat(mcp): include kingdom_id in list_vassals and get_events responses
  • 6abccf6 feat(mcp): detect parent kingdom on startup for observer mode
  • 979cce6 feat(mcp): add get_serial_events tool for serial vassal event query
  • 518e833 feat(mcp): add delegate_control, delegate_release, delegate_status tools with heartbeat
  • 8bc332a feat(logs): replace lore strings with structured logfmt codes
  • 9124e53 feat(fingerprint): add ESP32, NMEA, AT project type constants
  • 1cff3ba feat(fingerprint): add ESP32, NMEA, AT default contracts
  • b7a62b3 feat(discovery): add FindSerialPort with VID/PID table for serial autodetect
  • 6fdce37 feat(discovery): add FindAllKingdomSockets with multi-kingdom support
  • 6757fa2 feat(daemon,cmd): add kingdom.status RPC, king status and king prompt-info commands
  • e66e611 feat(daemon): use process groups (PGID) to kill vassal subtrees on shutdown
  • 3c7bebb feat(daemon): pre-inject serial contracts before sieve compile, fix vassal ID in sieve callback
  • 89b4ffa feat(daemon): guard watchVassal restart against delegated vassals
  • 1d47c7b feat(daemon): expand type:serial vassal into stty+cat command
  • efffa8a feat(daemon): auto-detect serial protocol and inject contracts by baud rate
  • 2d3051e feat(daemon): add vassal.register and vassal.list RPC for external vassal tracking
  • 98370cb feat(daemon): add vassal restart goroutine with exponential backoff
  • 2074edb feat(daemon): add delegation warden goroutine with heartbeat expiry
  • c2173d3 feat(daemon): add delegate_control, delegate_heartbeat, delegate_release RPC handlers
  • 24308b8 feat(daemon): add DelegationInfo struct and per-vassal delegation helpers
  • c1ded32 feat(config,daemon): accept auto:esp32 serial port syntax with VID/PID autodetect
  • 65c2d27 feat(config): default kingdom.yml uses vassals: [] with commented example
  • ca8cd98 feat(config): add serial port fields and security scanner config
  • 766c32c feat(config): add BaudRateOrDefault method (default 115200)
  • 5149ea0 feat(cmd): update king list to show per-vassal delegation status and controller
  • 2850c78 feat(cmd): show kingdom ID in king list output
  • 937083a...
Read more