feat: complete Windows client control and recovery paths

This commit is contained in:
2026-09-06 13:37:32 +00:00
parent 56b15c7f4f
commit 486894557d
38 changed files with 2188 additions and 106 deletions
+9 -3
View File
@@ -46,6 +46,8 @@ type CommandView struct {
OutputTruncated bool
OutputIncomplete bool
RetainedCompressedBytes uint64
LateAfterExpiry bool
Rejection []byte
ExecutionSpec []byte
WindowsIdentity []byte
}
@@ -182,7 +184,7 @@ func (store *Store) ListCommandViews(ctx context.Context, page CommandPage) ([]C
query := `SELECT issue_uuid, client_id, issue_time, server_receipt_time,
queue_expiry_time, terminal_time, lifecycle, revision, last_event_seq,
exit_code, output_truncated, output_incomplete, retained_compressed_bytes,
execution_spec, execution_spec_raw_bytes, windows_execution_identity
late_after_expiry, rejection, execution_spec, execution_spec_raw_bytes, windows_execution_identity
FROM commands WHERE client_id = ? AND issue_time <= ?`
args := []any{page.ClientID, page.SnapshotBoundary}
if !page.IncludeTerminal {
@@ -231,7 +233,7 @@ func (store *Store) GetCommandView(ctx context.Context, clientID string, issue d
query := `SELECT issue_uuid, client_id, issue_time, server_receipt_time,
queue_expiry_time, terminal_time, lifecycle, revision, last_event_seq,
exit_code, output_truncated, output_incomplete, retained_compressed_bytes,
execution_spec, execution_spec_raw_bytes, windows_execution_identity
late_after_expiry, rejection, execution_spec, execution_spec_raw_bytes, windows_execution_identity
FROM commands WHERE issue_uuid = ?`
args := []any{issue[:]}
if clientID != "" {
@@ -252,10 +254,12 @@ func scanCommandView(scanner interface{ Scan(...any) error }) (CommandView, erro
var expiry, terminal sql.NullInt64
var exit sql.NullInt64
var truncated, incomplete int
var lateAfterExpiry int
var rejection []byte
var rawBytes uint64
if err := scanner.Scan(&issue, &view.ClientID, &issueTime, &receipt, &expiry, &terminal,
&view.Lifecycle, &view.Revision, &view.LastEventSeq, &exit, &truncated, &incomplete,
&view.RetainedCompressedBytes, &stored, &rawBytes, &view.WindowsIdentity); err != nil {
&view.RetainedCompressedBytes, &lateAfterExpiry, &rejection, &stored, &rawBytes, &view.WindowsIdentity); err != nil {
return view, err
}
if len(issue) != 16 {
@@ -267,6 +271,8 @@ func scanCommandView(scanner interface{ Scan(...any) error }) (CommandView, erro
view.QueueExpiryTime = nullableTime(expiry)
view.TerminalTime = nullableTime(terminal)
view.OutputTruncated, view.OutputIncomplete = truncated == 1, incomplete == 1
view.LateAfterExpiry = lateAfterExpiry == 1
view.Rejection = append([]byte(nil), rejection...)
if exit.Valid {
if exit.Int64 < -1<<31 || exit.Int64 > 1<<31-1 {
return view, ErrInvalidSegmentRecord