fix(gate): ensure add-waiter command functions (#1265)
* fix(gate): use GateWait RPC for add-waiter command bd gate add-waiter was calling Update RPC which rejects waiters field (not in allowedUpdateFields). Changed to use existing GateWait RPC that handles waiters correctly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(storage): allow waiters field in UpdateIssue Add waiters to allowedUpdateFields whitelist and handle JSON serialization for the array field. This enables bd gate add-waiter to work in direct mode (--no-daemon). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(storage/dolt): allow waiters field in UpdateIssue Mirror the SQLite fix: add waiters to allowed fields and handle JSON serialization for the array field. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
dbd505656d
commit
8fab565f35
@@ -261,11 +261,12 @@ This is used by 'gt done --phase-complete' to register for gate wake notificatio
|
|||||||
|
|
||||||
// Update the gate
|
// Update the gate
|
||||||
if daemonClient != nil {
|
if daemonClient != nil {
|
||||||
updateArgs := &rpc.UpdateArgs{
|
// Use GateWait RPC which handles waiters correctly (bypasses allowedUpdateFields)
|
||||||
|
gateWaitArgs := &rpc.GateWaitArgs{
|
||||||
ID: gateID,
|
ID: gateID,
|
||||||
Waiters: newWaiters,
|
Waiters: []string{waiter}, // GateWait handles deduplication internally
|
||||||
}
|
}
|
||||||
resp, uerr := daemonClient.Update(updateArgs)
|
resp, uerr := daemonClient.GateWait(gateWaitArgs)
|
||||||
if uerr != nil {
|
if uerr != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error: %v\n", uerr)
|
fmt.Fprintf(os.Stderr, "Error: %v\n", uerr)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
@@ -251,7 +251,14 @@ func (s *DoltStore) UpdateIssue(ctx context.Context, id string, updates map[stri
|
|||||||
columnName = "ephemeral"
|
columnName = "ephemeral"
|
||||||
}
|
}
|
||||||
setClauses = append(setClauses, fmt.Sprintf("`%s` = ?", columnName))
|
setClauses = append(setClauses, fmt.Sprintf("`%s` = ?", columnName))
|
||||||
args = append(args, value)
|
|
||||||
|
// Handle JSON serialization for array fields stored as TEXT
|
||||||
|
if key == "waiters" {
|
||||||
|
waitersJSON, _ := json.Marshal(value)
|
||||||
|
args = append(args, string(waitersJSON))
|
||||||
|
} else {
|
||||||
|
args = append(args, value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-manage closed_at
|
// Auto-manage closed_at
|
||||||
@@ -631,7 +638,7 @@ func isAllowedUpdateField(key string) bool {
|
|||||||
"hook_bead": true, "role_bead": true, "agent_state": true, "last_activity": true,
|
"hook_bead": true, "role_bead": true, "agent_state": true, "last_activity": true,
|
||||||
"role_type": true, "rig": true, "mol_type": true,
|
"role_type": true, "rig": true, "mol_type": true,
|
||||||
"event_category": true, "event_actor": true, "event_target": true, "event_payload": true,
|
"event_category": true, "event_actor": true, "event_target": true, "event_payload": true,
|
||||||
"due_at": true, "defer_until": true, "await_id": true,
|
"due_at": true, "defer_until": true, "await_id": true, "waiters": true,
|
||||||
}
|
}
|
||||||
return allowed[key]
|
return allowed[key]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -804,6 +804,7 @@ var allowedUpdateFields = map[string]bool{
|
|||||||
"defer_until": true,
|
"defer_until": true,
|
||||||
// Gate fields (bd-z6kw: support await_id updates for gate discovery)
|
// Gate fields (bd-z6kw: support await_id updates for gate discovery)
|
||||||
"await_id": true,
|
"await_id": true,
|
||||||
|
"waiters": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// validatePriority validates a priority value
|
// validatePriority validates a priority value
|
||||||
@@ -913,7 +914,14 @@ func (s *SQLiteStorage) UpdateIssue(ctx context.Context, id string, updates map[
|
|||||||
columnName = "ephemeral"
|
columnName = "ephemeral"
|
||||||
}
|
}
|
||||||
setClauses = append(setClauses, fmt.Sprintf("%s = ?", columnName))
|
setClauses = append(setClauses, fmt.Sprintf("%s = ?", columnName))
|
||||||
args = append(args, value)
|
|
||||||
|
// Handle JSON serialization for array fields stored as TEXT
|
||||||
|
if key == "waiters" {
|
||||||
|
waitersJSON, _ := json.Marshal(value)
|
||||||
|
args = append(args, string(waitersJSON))
|
||||||
|
} else {
|
||||||
|
args = append(args, value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-manage closed_at when status changes (enforce invariant)
|
// Auto-manage closed_at when status changes (enforce invariant)
|
||||||
|
|||||||
Reference in New Issue
Block a user