Skip to content

Add streamed heartbeat/phase logs for long-running EA tasks (and bump version for CI gate)#393

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/investigate-progress-log-issue
Draft

Add streamed heartbeat/phase logs for long-running EA tasks (and bump version for CI gate)#393
Copilot wants to merge 4 commits into
mainfrom
copilot/investigate-progress-log-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

Background

  • Issue/Motivation: Users reported long silent periods during EA execution, making it impossible to tell whether the agent was actively working, waiting on tools/LLM, or stalled. During review, CI/CD also failed on the repository version gate.
  • Root Cause (if bug fix): run_streamed() only emitted logs on discrete stream events (LLM/tool boundaries), so no liveness signal was produced during quiet intervals. Separately, PR version equaled origin/main (0.7.77), failing the CI version bump check.

What Changed

  • Liveness signal in streaming loop
    • Added periodic heartbeat log events during stream silence windows.
  • Execution phase exposure
    • Heartbeats include phase (planning, waiting_for_llm, processing_response, tool_calling) plus elapsed/idle timing and last tool-call timestamp/name.
  • Frontend visibility
    • Added explicit heartbeat rendering in the xterm log view so operators can see activity without waiting for tool/LLM boundaries.
  • Targeted regression coverage
    • Added tests for silent-window heartbeat emission and last-tool metadata propagation.
  • CI gate fix
    • Bumped project/package version from 0.7.77 to 0.7.78 to satisfy CI’s PR>main version requirement.
on_log("heartbeat", {
    "phase": current_phase,
    "idle_seconds": int(idle_seconds),
    "elapsed_seconds": elapsed_seconds,
    "last_tool_name": last_tool_name,
    "last_tool_call_at": last_tool_called_at,
    "content": f"⏱ heartbeat phase={current_phase} idle={int(idle_seconds)}s elapsed={elapsed_seconds}s",
})

Key Design Decisions

  • Emit heartbeat at the same on_log layer as existing task logs to avoid transport/protocol changes.
  • Keep heartbeat payload backward-compatible with existing log schema (type + content), while adding structured fields for richer UI use.
  • Expose coarse phase states from existing stream event boundaries instead of introducing a new state machine.
  • Resolve CI failure with the smallest safe change (version bump only), without touching runtime logic.

Files Changed (annotated)

File Change
src/onemancompany/agents/base.py Added silent-period heartbeat emitter in run_streamed(), phase tracking, and last tool-call metadata in heartbeat payload.
frontend/xterm-log.js Added heartbeat log rendering (beat) for real-time liveness visibility in trace/log panel.
tests/unit/agents/test_base.py Added focused tests for heartbeat emission during silence and heartbeat inclusion of last tool-call context.
pyproject.toml Bumped project version from 0.7.77 to 0.7.78 for CI version gate.
package.json Bumped package version from 0.7.77 to 0.7.78 to keep versions aligned.

Type

  • Bug fix
  • New feature
  • Refactor
  • Visualization / Theme
  • Talent package
  • Documentation
  • Other

Review Checklist

Phase 1 — Bug Hunt

  • No off-by-one, null-ref, or race conditions introduced
  • Error paths tested (what happens when it fails?)
  • Edge cases covered (empty input, duplicates, concurrent access)

Phase 2 — Design Principles (docs/design-principles.md)

  • Single Source of Truth — No duplicated state; data has one owner, one write function
  • Systematic Design — Structural fix, not a patch (would a second similar request need the same code touched?)
  • Modular & General-Purpose — New capability addable without modifying existing code
  • Complete Data Package — New state is serializable, recoverable, registered, terminable
  • No Silent Exceptions — No except: pass; errors logged, CancelledError re-raised
  • Registry/Dispatch — No if-elif chains for type dispatch
  • Status via transition() — No direct node.status = ... assignment
  • Minimal Complexity — No premature abstractions; minimum code for current requirements

Phase 3 — Side Effects

  • No unintended behavioral changes to existing features
  • Serialization/persistence formats are backward-compatible (or migration provided)
  • No new circular imports introduced

Test Plan

  • Unit tests pass (.venv/bin/python -m pytest tests/unit/ -x)
  • Compilation check (.venv/bin/python -c "from onemancompany.api.routes import router; print('OK')")
  • Frontend syntax check (node -c frontend/app.js)
  • New tests written for new/changed behavior
  • Manual testing (describe below)

Manual Test Steps

  1. Run a long/silent EA task and observe the live log stream.
  2. Confirm heartbeat entries appear during silence windows with phase + timing metadata.
  3. Confirm heartbeat continues until next tool/LLM event and does not break existing tool/result rendering.
  4. Confirm CI version gate passes with PR version 0.7.78 > main.

Screenshots

Copilot AI changed the title [WIP] Investigate progress log issues during long tasks Add streamed heartbeat/phase logs for long-running EA tasks May 13, 2026
Copilot AI requested a review from zhengxuyu May 13, 2026 09:52
@zhengxuyu
Copy link
Copy Markdown
Collaborator

@copilot ci/cd没过

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 13, 2026

@copilot ci/cd没过

已定位并修复:CI 失败点是版本门禁(PR version 必须大于 main)。我已把 pyproject.tomlpackage.json0.7.77 提升到 0.7.78,修复提交是 635f0c9。请看这次提交触发的 CI 结果。

Copilot AI changed the title Add streamed heartbeat/phase logs for long-running EA tasks Add streamed heartbeat/phase logs for long-running EA tasks (and bump version for CI gate) May 13, 2026
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.

[User feedback] No progress log during long tasks — can't tell if EA is working — needs investigation

2 participants