Managed session log file is never written #43
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
kahliburke/Kaimon.jl#43
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug: Managed session log file is never written
Summary
ManagedSession.log_fileis constructed and quoted to the user in error messages, but no code path ever writes to it. When a session subprocess crashes, the agent is told "Check log: " and finds nothing there.Reproduction
mcp__kaimon__start_sessionwith a project whose subprocess crashes during boot.Error: Session failed to start — Process died at <ts>\nCheck log: <path>.Root cause
In
src/session_manager.jl:ManagedSession(project_path; ...)(line ~23) setslog_file = joinpath(log_dir, "$(basename(project_path)).log").spawn_session!(line ~122) launches the subprocess viaTachikoma.pty_spawn(cmd; rows = 24, cols = 80, env)and stores only the PTY handle inms.pty. Stdout/stderr go to the PTY master fd; nothing drains them to disk.src/tool_definitions.jl:726,730quotems.log_fileunconditionally.Compare with
spawn_extension!insrc/extension_manager.jl:236-240, which actually opens and redirects to the log file:It also closes
log_ioin the exit-watcher@asyncblock.Impact
When a managed session fails to start (bad project, missing dep, instantiate error, version mismatch), the only surfaced error is the generic "Process died at " recorded by
_push_session_error!. The actual stack trace and Julia stderr output are lost. This makes debugging session-startup failures effectively impossible without re-running the same command manually outside Kaimon.Related files
src/session_manager.jl—ManagedSessionstruct (line ~11),spawn_session!(line ~122)src/tool_definitions.jl:726,730— error messages that quotems.log_filesrc/extension_manager.jl:230-267— reference implementation that does write its logI'll investigate, thank you for the report and PR. Sorry for the long delay before a response.
Fixed for 2.0 via #44 (@csvance), cherry-picked to
2.0-integration(a0d5198). Managed-session output now tees to the log file through the PTY reader, so a crashed boot's stderr/stacktrace is captured. It also fixes a latent issue —pty.outputis a boundedChannel(64)with no consumer for managed sessions, so a verbose or failing boot could fill it and stall the child; the log tee drains it continuously. Verified live: the session log now fills with boot output.