Skip to content

feat: record and expose timestamped unit events over the agent socket#27149

Open
SasSwart wants to merge 2 commits into
mainfrom
sync-unit-events
Open

feat: record and expose timestamped unit events over the agent socket#27149
SasSwart wants to merge 2 commits into
mainfrom
sync-unit-events

Conversation

@SasSwart

@SasSwart SasSwart commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

PR 1 of 2 that adds a "History" section in the unit status command to make troubleshooting units easier. This first PR adds the history tracking to the unit manager. The next wires it up to a CLI command.

See example output:

coder@blue-guan-18:~$ coder exp sync status 'coder_script.startup_unit["health-check"]'
Unit: coder_script.startup_unit["health-check"]
Status: completed
Ready: true

Dependencies:
DEPENDS ON                             REQUIRED STATUS  CURRENT STATUS  SATISFIED  
coder_script.startup_unit["frontend"]  completed        completed       true       
coder_script.startup_unit["worker"]    completed        completed       true       

History:
TIME          ELAPSED  EVENT                                                         
11:43:14.295  +0.0s    registered (pending)                                          
11:43:14.295  +0.0s    depends on coder_script.startup_unit["worker"] (completed)    
11:43:14.295  +0.0s    depends on coder_script.startup_unit["frontend"] (completed)  
11:44:34.304  +80.0s   pending → started                                             
11:44:44.306  +90.0s   started → completed                                           
coder@blue-guan-18:~$ 

@SasSwart SasSwart left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self review done.

Comment thread agent/agentsocket/proto/agentsocket.proto
Comment thread agent/agentsocket/proto/agentsocket.proto Outdated
Comment thread agent/unit/events.go
Comment thread agent/unit/events_test.go
Comment thread agent/unit/manager.go Outdated
Comment thread agent/unit/manager.go
@SasSwart SasSwart marked this pull request as ready for review July 12, 2026 12:21
Rename UnitEvent fields to more descriptive names in response to
self-review feedback:
  seq         -> sequence_number
  unit        -> unit_id
  from        -> from_status
  to          -> to_status
  depends_on  -> depends_on_unit

Applied consistently across the proto wire type, regenerated code, the
Go unit.Event domain type, the socket client/service conversions, tests,
and the CLI golden output. Also renames the Manager's internal seq
counter to sequenceNumber.

Coder Agents generated.
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