Skip to content

Add observer logging throughout orchestration loops#65

Merged
BillJr99 merged 1 commit into
masterfrom
claude/determined-goldberg-SCSSr
May 24, 2026
Merged

Add observer logging throughout orchestration loops#65
BillJr99 merged 1 commit into
masterfrom
claude/determined-goldberg-SCSSr

Conversation

@BillJr99
Copy link
Copy Markdown
Owner

Summary

This PR adds comprehensive observer logging throughout the orchestration system to provide real-time status updates to the TUI status pane. The changes mirror important workflow events to both the log file and the observer interface, improving visibility into the execution flow.

Key Changes

  • New _observer_log() helper method in ralph_loop.py and autoresearch_loop.py: Centralizes the pattern of logging to both the file log and the observer's TUI status pane, with graceful error handling for missing observers.

  • Ralph loop status updates: Added observer logging at critical points:

    • Plan dispatch (ralph #{idx} :: plan :: dispatching ralph)
    • Engineer phase with objective preview (ralph #{idx} :: engineer :: {objective})
    • QA pass dispatch (ralph #{idx} :: qa :: dispatching audit pass)
    • Plateau escalation and reframing actions
    • Regression detection
  • Autoresearch loop status updates: Added observer logging for:

    • Survey dispatch (autoresearch #{idx} :: survey :: dispatching ralph)
    • Analyst investigation with question preview
    • Critic review dispatch
  • Agent consensus logging: Added observer logging in agent.py for:

    • Sample dispatch with agent name (consensus :: {name} :: sample #{sample} dispatching ({agent_name}))
    • Sample completion with status (consensus :: {name} :: sample #{sample} done (ok|error))
    • Meta-prompt drafting operations (dispatch and role prompts via chief)
  • TUI improvement: Enhanced begin_agent() in tui.py to extract the first non-empty line from multi-line objectives, preventing stray fragments in the log pane from objectives that start with blank lines (e.g., recovery dispatches).

Implementation Details

  • The _observer_log() method safely handles cases where the observer is not available via getattr() with a default of None
  • All observer logging calls are wrapped in try-except blocks to prevent failures in the observer from disrupting the main workflow
  • Status messages follow a consistent format: {context} :: {phase} :: {action/detail}
  • Long objectives are truncated to 60 characters for readability in status messages

https://claude.ai/code/session_01WGeyhTG21J7tyC5UgbuzQ9

begin_agent() was doing objective[:80] before splitting on newlines,
so a multi-line objective (e.g. the recovery dispatch whose text is
'Recovery dispatch for workflow…\n\nThis stage depends on: …') got
sliced to exactly 80 chars and then split(), leaving a dangling
fragment like 'This stage de' as a separate log entry.

Fix: take the first non-empty line of the objective before truncating
to 80 chars, so only the header line appears in the pane.

feat(status-log): INFO-log stochastic consensus and sub-agent activity

Four new sets of observer-log lines now reach both the TUI status
pane and the session.log file:

agent.py
  _run_consensus_sample  – 'consensus :: <name> :: sample #N dispatching (<agent>)'
                           'consensus :: <name> :: sample #N done (ok|error:…)'
  meta_draft_dispatch_prompt – 'meta :: drafting dispatch prompt for <agent> via chief'
  meta_draft_role_prompt     – 'meta :: drafting role prompt for <role> via chief'

autoresearch_loop.py
  _observer_log() helper (mirrors agent._observer_log pattern)
  per-step: survey / analyst / critic dispatch announcements

ralph_loop.py
  _observer_log() helper
  per-iteration: plan / engineer / qa dispatch announcements
  _handle_plateau: escalate and reframe notices
  _handle_regression: regression-detected + critic dispatch notice

https://claude.ai/code/session_01WGeyhTG21J7tyC5UgbuzQ9
@BillJr99 BillJr99 merged commit 1d4ded3 into master May 24, 2026
4 checks passed
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.

2 participants