Compare commits

...

5 Commits

Author SHA1 Message Date
core-be bf719f7570 fix(handlers): log DB scan/exec errors previously silently ignored
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 37s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 59s
CI / Detect changes (pull_request) Successful in 1m45s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 33s
Harness Replays / detect-changes (pull_request) Successful in 34s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m44s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 39s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m52s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 2m20s
qa-review / approved (pull_request) Failing after 1m37s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 2m35s
gate-check-v3 / gate-check (pull_request) Successful in 1m51s
security-review / approved (pull_request) Failing after 1m11s
sop-tier-check / tier-check (pull_request) Successful in 50s
CI / Python Lint & Test (pull_request) Successful in 8m22s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m34s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 16s
CI / Canvas (Next.js) (pull_request) Successful in 20m40s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 11m49s
Harness Replays / Harness Replays (pull_request) Failing after 11m40s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Failing after 11m30s
CI / Platform (Go) (pull_request) Successful in 22m44s
CI / all-required (pull_request) Successful in 22m56s
CI / Canvas Deploy Reminder (pull_request) Failing after 14m57s
sop-checklist / all-items-acked (pull_request) [info tier:low] acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, l
audit-force-merge / audit (pull_request) Has been skipped
- approvals.go Create: log parent workspace lookup Scan error
  (DB failure now surfaces instead of silently skipping escalation)
- approvals.go ListAll: log auto-expire ExecContext error
  (stale approvals no longer silently accumulate on DB failure)
- terminal.go HandleConnect: log instance_id lookup Scan error
  (workspace not found now surfaces instead of falling to local Docker silently)
- terminal.go handleLocalConnect: log workspace name lookup Scan error
  (name lookup failure now surfaces instead of being silently skipped)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 04:24:11 +00:00
core-be 66d98074ef chore: restart CI pipeline
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 20s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 32s
CI / Detect changes (pull_request) Successful in 56s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 24s
Harness Replays / detect-changes (pull_request) Successful in 31s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m30s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m26s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 28s
qa-review / approved (pull_request) Failing after 50s
security-review / approved (pull_request) Failing after 46s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m15s
gate-check-v3 / gate-check (pull_request) Successful in 1m10s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m37s
Harness Replays / Harness Replays (pull_request) Successful in 9s
sop-tier-check / tier-check (pull_request) Successful in 43s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 23s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 14s
CI / Python Lint & Test (pull_request) Successful in 8m8s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Failing after 6m18s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 7m32s
CI / Canvas (Next.js) (pull_request) Successful in 19m12s
CI / Platform (Go) (pull_request) Successful in 20m59s
CI / all-required (pull_request) Successful in 20m59s
CI / Canvas Deploy Reminder (pull_request) Successful in 9s
sop-checklist / all-items-acked (pull_request) [info tier:low] acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4
2026-05-15 03:04:18 +00:00
core-be fb9c373a4b chore: re-run CI (second attempt) 2026-05-15 03:04:18 +00:00
core-be 9871e7b3c3 chore: re-run CI to confirm pipeline health 2026-05-15 03:04:18 +00:00
core-be 6498ed758b fix(handlers): add rows.Err() checks to Resolve handler and scanInstructions
The Resolve handler and scanInstructions both had rows.Next() loops
without a rows.Err() check. Without rows.Err(), a database scan error
(e.g. connection drop mid-stream) is silently swallowed and the handler
returns a truncated result with HTTP 200 — a data-integrity gap.

Fixes:
- Resolve: rows.Err() check after loop, logs workspaceID + error
- scanInstructions: adds Err() error to interface constraint and rows.Err()
  check after loop

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 03:04:18 +00:00
3 changed files with 21 additions and 6 deletions
@@ -60,7 +60,9 @@ func (h *ApprovalsHandler) Create(c *gin.Context) {
// Auto-escalate to parent
var parentID *string
db.DB.QueryRowContext(ctx, `SELECT parent_id FROM workspaces WHERE id = $1`, workspaceID).Scan(&parentID)
if err := db.DB.QueryRowContext(ctx, `SELECT parent_id FROM workspaces WHERE id = $1`, workspaceID).Scan(&parentID); err != nil {
log.Printf("CreateApproval parent lookup error workspace=%s: %v", workspaceID, err)
}
if parentID != nil {
h.broadcaster.RecordAndBroadcast(ctx, string(events.EventApprovalEscalated), *parentID, map[string]interface{}{
"approval_id": approvalID,
@@ -80,10 +82,12 @@ func (h *ApprovalsHandler) ListAll(c *gin.Context) {
ctx := c.Request.Context()
// Auto-expire stale approvals (older than 10 min)
db.DB.ExecContext(ctx, `
if _, err := db.DB.ExecContext(ctx, `
UPDATE approval_requests SET status = 'denied', decided_by = 'auto-expired', decided_at = now()
WHERE status = 'pending' AND created_at < now() - interval '10 minutes'
`)
`); err != nil {
log.Printf("ListAll auto-expire error: %v", err)
}
rows, err := db.DB.QueryContext(ctx, `
SELECT a.id, a.workspace_id, w.name, a.action, a.reason, a.status, a.created_at
@@ -248,6 +248,9 @@ func (h *InstructionsHandler) Resolve(c *gin.Context) {
b.WriteString(content)
b.WriteString("\n\n")
}
if rowsErr := rows.Err(); rowsErr != nil {
log.Printf("ResolveInstructions rows.Err workspace=%s: %v", workspaceID, rowsErr)
}
c.JSON(http.StatusOK, gin.H{
"workspace_id": workspaceID,
@@ -258,6 +261,7 @@ func (h *InstructionsHandler) Resolve(c *gin.Context) {
func scanInstructions(rows interface {
Next() bool
Scan(dest ...interface{}) error
Err() error
}) []Instruction {
var instructions []Instruction
for rows.Next() {
@@ -269,6 +273,9 @@ func scanInstructions(rows interface {
}
instructions = append(instructions, inst)
}
if scanErr := rows.Err(); scanErr != nil {
log.Printf("scanInstructions rows.Err: %v", scanErr)
}
if instructions == nil {
instructions = []Instruction{}
}
@@ -109,9 +109,11 @@ func (h *TerminalHandler) HandleConnect(c *gin.Context) {
// provisionWorkspaceCP → migration 038). Null instance_id means the
// workspace runs as a local Docker container on this tenant.
var instanceID string
db.DB.QueryRowContext(ctx,
if err := db.DB.QueryRowContext(ctx,
`SELECT COALESCE(instance_id, '') FROM workspaces WHERE id = $1`,
workspaceID).Scan(&instanceID)
workspaceID).Scan(&instanceID); err != nil {
log.Printf("HandleConnect instanceID lookup error workspace=%s: %v", workspaceID, err)
}
if instanceID != "" {
h.handleRemoteConnect(c, workspaceID, instanceID)
@@ -144,7 +146,9 @@ func (h *TerminalHandler) handleLocalConnect(c *gin.Context, workspaceID string)
// Look up workspace name for manual container naming
var wsName string
if _, err := h.docker.Ping(ctx); err == nil {
db.DB.QueryRowContext(ctx, `SELECT LOWER(REPLACE(name, ' ', '-')) FROM workspaces WHERE id = $1`, workspaceID).Scan(&wsName)
if err := db.DB.QueryRowContext(ctx, `SELECT LOWER(REPLACE(name, ' ', '-')) FROM workspaces WHERE id = $1`, workspaceID).Scan(&wsName); err != nil {
log.Printf("handleLocalConnect wsName lookup error workspace=%s: %v", workspaceID, err)
}
if wsName != "" {
candidates = append(candidates, wsName)
}