worker+voice: per-conn context, store error hygiene, StateDir wiring, pipe leak

worker/server.go: dispatch now receives a per-connection context instead of
context.Background(), so handler cancellation propagates on conn close.

voice/server.go: same — per-conn context fed through safeDispatch into
HandlePushToTalk instead of context.Background().

store/reminders.go: propagate LastInsertId error.
store/nudges.go: propagate LastInsertId and RowsAffected errors.
store/tools.go: propagate RowsAffected error.

config/config.go: applyDefaults now respects StateDir when set, using it as
the base for empty DBPath/SocketPath instead of silently ignoring it.

phraser/llmphraser.go: close stderr pipe fd when cmd.Start() fails.
This commit is contained in:
kami
2026-07-03 11:03:14 +02:00
parent b77f209686
commit 861e418669
7 changed files with 47 additions and 18 deletions
+17 -5
View File
@@ -256,11 +256,23 @@ func (c *Config) applyDefaults() {
if c.AutotuneInterval == 0 {
c.AutotuneInterval = Duration(DefaultAutotuneInterval)
}
if c.DBPath == "" {
c.DBPath = filepath.Join(defaultDataDir(), "maven.db")
}
if c.SocketPath == "" {
c.SocketPath = filepath.Join(defaultRuntimeDir(), "mavend.sock")
// StateDir — when set, use it as the base for both db and socket if their
// paths are still relative (empty). If StateDir is empty, fall back to the
// XDG-style defaults (data dir for db, runtime dir for socket).
if c.StateDir != "" {
if c.DBPath == "" {
c.DBPath = filepath.Join(c.StateDir, "maven.db")
}
if c.SocketPath == "" {
c.SocketPath = filepath.Join(c.StateDir, "mavend.sock")
}
} else {
if c.DBPath == "" {
c.DBPath = filepath.Join(defaultDataDir(), "maven.db")
}
if c.SocketPath == "" {
c.SocketPath = filepath.Join(defaultRuntimeDir(), "mavend.sock")
}
}
}