Skip to content

feat: derive unit readiness intervals and add sync timeline CLI#27150

Draft
SasSwart wants to merge 1 commit into
sync-unit-eventsfrom
sync-unit-timeline
Draft

feat: derive unit readiness intervals and add sync timeline CLI#27150
SasSwart wants to merge 1 commit into
sync-unit-eventsfrom
sync-unit-timeline

Conversation

@SasSwart

Copy link
Copy Markdown
Contributor

Adds the consumer half of the Script Coordination timing RFC (PR 2 of 2, stacked on #27149): readiness-interval derivation from the unit event log, a history section in coder exp sync status, and a new coder exp sync timeline command.

Summary

  • agent/unit: new DeriveIntervals pure function that replays the event log and returns per-unit lifecycle intervals (blocked | ready | running | done). Readiness is derived, not stored: the fold mirrors recalculateReadinessUnsafe and handles the late dependency_added edge case where a ready unit flips back to blocked with no status change.
  • coder exp sync status: table output gains a "History" section (time, elapsed, event) after the dependencies table. JSON output is unchanged from feat: record and expose timestamped unit events over the agent socket #27149.
  • coder exp sync timeline (new): renders the full cross-unit event log as a git-log-style ASCII graph. Each unit gets a lane; every event prints a * row with an elapsed-time label; dependency-satisfaction points draw an inter-lane connector plus a derived "ready" row; lanes disappear when a unit completes. --output json emits the raw event list. Older agents without the SyncTimeline RPC get a clear "agent does not support timeline" error.

Example graph output:

*  [+0.0s]  test-unit  registered (pending)
*  [+0.0s]  test-unit  depends on dep-unit (completed)
| *  [+0.1s]  dep-unit  registered (pending)
| *  [+0.1s]  dep-unit  pending → started
| *  [+2.3s]  dep-unit  started → completed
| /
*  [+2.3s]  test-unit  ready (dependency satisfied)
*  [+2.4s]  test-unit  pending → started
*  [+8.0s]  test-unit  started → completed

Test-support change: agentsocket.NewServer gains a WithUnitManager option so CLI tests inject a mock-clock unit manager, keeping history timestamps in table goldens deterministic.

Testing

  • agent/unit: DeriveIntervals covered for single-unit lifecycle, blocked-until-satisfied, the late-edge ready-to-blocked flip, multiple dependencies, status-specific requirements, and unregistered dependencies.
  • cli: renderer unit tests with varied timestamps (lanes, connectors, no-false-ready), plus golden tests for sync timeline (empty, graph, JSON) and the updated sync status goldens. Reviewers should read the goldens; they are the primary review artifact for the rendering changes.

Generated by Coder Agents on behalf of @SasSwart.

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.

1 participant