Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions docs/triage/pr-remediation-2026-07-29.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# PR Remediation Run — 2026-07-29

Runbook: PR Remediation & Publish Runbook (RASOR). GitHub surface: `github-mcp`
(PR read + comment + merge). Scan performed against `groupthinking/eventrelay`,
oldest-first. Auto-merge policy: `label:automerge` (no open PR carries it) → every
merge to protected `main` remains a human gate by design. Prior records: #1044
(2026-07-27), #1059 (2026-07-28).

## Definition-of-done outcome

- **Open PRs scanned:** 36
- **Autonomously mergeable this run:** 0 — the correct, safe outcome, not a failure.
All 36 open PRs are drafts (scope-gated → `DEFERRED(draft)`). Merging any of them
requires the author to first mark the PR ready and a human to clear the publish gate
on protected `main`.
- **Terminal-state tally:** 36 `DEFERRED(draft)`, 0 `HALTED`, 0 `MERGED`.
- **Delta vs 2026-07-28:** +3 net open PRs (33 → 36). New since last run: #1059
(the 07-28 triage record itself), #1064 (`docs(runbook)` Google OAuth 403 diagnosis),
#1075 (`fix(pipeline)` preserve captured transcript on analysis timeout). No PR was
merged or closed between runs.
- **#903 status change:** on 2026-07-28 #903 was the single non-draft, human-gated PR
(`HALTED(awaiting_human_production_approval)`). It has since been **restored to draft**
(`draft: true`, head `jules-15243187445261469621-ffdb089e@57ff988`,
`mergeable_state: unstable`). It therefore scope-gates to `DEFERRED(draft)` this run —
no PR remains in a HALTED (human-decision-pending) state today.

## Why zero autonomous merges (unchanged, structural)

1. **Every open PR is a draft.** The runbook scope gate routes drafts to
`DEFERRED` — the author must request review before any remediation loop can advance
them. This is a repo-wide posture, not a per-PR defect.
2. **Protected `main` + human publish gate.** No open PR carries the `automerge` label,
so `auto_merge_policy: label:automerge` yields no eligible merge. Auto-merging to a
protected branch is explicitly out of scope for the runbook.
3. **No outward-facing CodeRabbit fan-out performed.** Posting `@coderabbitai full review`
across 36 draft PRs (15 of them dependabot bumps, several duplicate bot proposals)
would consume the paid review allowance for no mergeable outcome. Deferred until a PR
flips to ready.

## Deferred — drafts (scope gate: draft → `DEFERRED(draft)`)

| PR | Age (d) | Author | Title | Terminal state |
|----|---------|--------|-------|----------------|
| 734 | 17 | groupthinking | fix(security): pin cloud callbacks against DNS rebinding | DEFERRED(draft) |
| 810 | 12 | groupthinking | fix(security): sanitize user-controlled values in API logs (CWE-117) | DEFERRED(draft) |
| 831 | 12 | groupthinking | fix(security): restore CWE-209 response protections | DEFERRED(draft) |
| 869 | 11 | groupthinking | fix: harden API-cost webhook outbox retries (MYX-79) | DEFERRED(draft) |
| 903 | 9 | jules[bot] | fix(auth): restore Google OAuth configuration in Vercel production | DEFERRED(draft) |
| 906 | 9 | groupthinking | fix(ci): remediate PR #877 rollout and verification gaps | DEFERRED(draft) |
| 961 | 6 | jules[bot] | [DRAFT EVIDENCE] duplicate dashboard accessibility proposal | DEFERRED(draft) |
| 987 | 4 | Copilot | [DRAFT EVIDENCE] unbound CI and module-shadowing proposal | DEFERRED(draft) |
| 995 | 4 | groupthinking | perf(mcp): reuse pooled aiohttp session in orchestrator | DEFERRED(draft) |
| 996 | 4 | groupthinking | fix(mcp): actually reuse pooled aiohttp session | DEFERRED(draft) |
| 997 | 4 | jules[bot] | Bolt: optimize layout boundary in AgentFlowVisualizer | DEFERRED(draft) |
| 999 | 4 | dependabot | build(deps): bump gh-aw-actions/setup 0.82.14→0.83 | DEFERRED(draft) |
| 1000 | 4 | dependabot | build(deps): bump actions/checkout 4.2.2→7.0.1 | DEFERRED(draft) |
| 1001 | 4 | dependabot | build(deps): bump actions/setup-python 6→7 | DEFERRED(draft) |
| 1002 | 4 | dependabot | build(deps-dev): bump locust 2.45.0→2.46.0 | DEFERRED(draft) |
| 1003 | 4 | dependabot | build(deps): bump actions/github-script 8→9 | DEFERRED(draft) |
| 1004 | 4 | dependabot | build(deps): bump @opentelemetry/exporter-trace-otlp-http | DEFERRED(draft) |
| 1005 | 4 | dependabot | build(deps): bump @opentelemetry/core 2.9.0→2.10.0 | DEFERRED(draft) |
| 1006 | 4 | dependabot | build(deps): bump @opentelemetry/instrumentation | DEFERRED(draft) |
| 1007 | 4 | dependabot | build(deps): bump @opentelemetry/resources 2.9.0→2.10.0 | DEFERRED(draft) |
| 1008 | 4 | dependabot | build(deps): bump @opentelemetry/sdk-trace-base | DEFERRED(draft) |
| 1020 | 3 | jules[bot] | perf: optimize call stack operations and string allocations | DEFERRED(draft) |
| 1022 | 3 | jules[bot] | perf(web): optimize bounding box in AgentFlowVisualizer | DEFERRED(draft) |
| 1038 | 2 | jules[bot] | feat: implement MCPOrchestrator._execute_on_server E2E | DEFERRED(draft) |
| 1040 | 2 | groupthinking | fix(mcp): green up MCPOrchestrator._execute_on_server E2E | DEFERRED(draft) |
| 1043 | 2 | jules[bot] | perf(web): optimize viewBox boundary computation | DEFERRED(draft) |
| 1044 | 2 | groupthinking | docs(triage): PR remediation run 2026-07-27 | DEFERRED(draft) |
| 1045 | 2 | jules[bot] | Palette: add keyboard focus-visible styling to dashboard | DEFERRED(draft) |
| 1047 | 2 | jules[bot] | ci: suppress failure issues on no-op runs | DEFERRED(draft) |
| 1049 | 2 | groupthinking | fix(a11y): complete dashboard focus contrast + coverage | DEFERRED(draft) |
| 1050 | 2 | jules[bot] | configure agentic workflows no-op comment suppression | DEFERRED(draft) |
| 1052 | 2 | jules[bot] | fix: allow awmg-mcpg gateway in workflow firewalls | DEFERRED(draft) |
| 1055 | 1 | dependabot | build(deps): bump npm-minor-patch group | DEFERRED(draft) |
| 1059 | 1 | groupthinking | docs(triage): PR remediation run 2026-07-28 | DEFERRED(draft) |
| 1064 | 1 | groupthinking | docs(runbook): diagnose Google OAuth 403 org_internal | DEFERRED(draft) |
| 1075 | 0 | groupthinking | fix(pipeline): preserve captured transcript on analysis timeout | DEFERRED(draft) |

## Duplicate clusters worth a human close (housekeeping, not autonomous)

These are labeled `duplicate` by the repo's own triage automation and represent
redundant bot proposals accumulating in the backlog. A human closing the superseded
members would shrink the draft queue without any code risk:

- **AgentFlowVisualizer boundary/viewBox perf:** #997, #1022, #1043 (and related #1020)
— repeated bot passes over the same layout-computation hot path.
- **OpenTelemetry JS bumps:** #1004–#1008 all tagged `duplicate` (overlap with the
#1055 `npm-minor-patch` group bump).
- **aiohttp pooled-session reuse:** #995 vs #996 (same MCP orchestrator change).

## Loop decision

**More autonomous work available: no.** Every open PR is a draft; none carries
`automerge`; the one previously human-gated PR (#903) has been returned to draft. The
remediation loop cannot advance any PR to `MERGED` without a human first marking a PR
ready for review and clearing the protected-`main` publish gate. This matches the
2026-07-27 (#1044) and 2026-07-28 (#1059) conclusions — the backlog is human-gated by
design, so the loop should idle until a draft flips to ready, a PR gains `automerge`, or
the owner acts on the #903 / #900 production-OAuth decision.

## This run's branch (`claude/determined-maxwell-82cm3w`)

Beyond this triage record, the run's branch carries the **refreshed canonical CWE-209
response-sanitization work for #831** (13 commits, ~1000 insertions across
`cloud_api_endpoints.py`, `real_api_endpoints.py`, `cloud_ai_routes.py`,
`official_api.py`, `code_generator.py`, and their tests), rebased onto verified `main`
(0 commits behind). It is surfaced here as a **draft** PR for human review — it is a
security change, so it stays behind the same human publish gate as every other PR and is
not auto-merged.
12 changes: 10 additions & 2 deletions src/agents/specialized/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def _load_templates(self) -> dict[str, str]:
return {
"fastapi_endpoint": textwrap.dedent(
"""
import logging

logger = logging.getLogger(__name__)

@app.post("/api/v1/{endpoint_name}")
async def {function_name}({parameters}):
\"\"\"
Expand All @@ -42,8 +46,12 @@ async def {function_name}({parameters}):
}}
except ValidationError as e:
raise HTTPException(status_code=400, detail=str(e))
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
except Exception:
logger.exception("Generated endpoint failed")
raise HTTPException(
status_code=500,
detail="Internal server error",
)
"""
),
"rest_api": textwrap.dedent(
Expand Down
2 changes: 1 addition & 1 deletion src/youtube_extension/backend/cloud_ai_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ async def analyze_video(request: VideoAnalysisRequest):
# Must precede CloudAIError: RateLimitError subclasses it, so catching
# the base first would shadow this handler and return a 503 instead.
logger.warning(f"Rate limit exceeded: {e}")
raise HTTPException(status_code=429, detail=f"Rate limit exceeded: {str(e)}")
raise HTTPException(status_code=429, detail="Rate limit exceeded")
except ConfigurationError as e:
# Must precede CloudAIError (same subclassing reason) so configuration
# failures reach this sanitized 500 rather than the dynamic 503 below.
Expand Down
93 changes: 70 additions & 23 deletions src/youtube_extension/backend/cloud_api_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,50 @@
router = APIRouter()


def _client_safe_error(error_message: Any) -> Optional[str]:
"""Return a stable client-safe value for persisted processor failures.

Older Firestore records may predate the write-side sanitizer, so every read
boundary must treat stored error text as untrusted rather than echoing it.
"""
return "Internal server error" if error_message else None


def _sanitize_error_list(value: Any) -> Any:
"""Replace scalar diagnostic entries while preserving structured shapes."""
if isinstance(value, list):
return [_sanitize_error_list(item) for item in value]
if isinstance(value, tuple):
return tuple(_sanitize_error_list(item) for item in value)
if isinstance(value, dict):
return _sanitize_response_errors(value)
# Every remaining leaf is a scalar diagnostic. Only ``None`` (absence of an
# error) is preserved; any other non-null leaf — including non-string types
# such as bytes, ints, or bools that FastAPI can still serialize — is
# replaced so it cannot bypass the scalar sanitization invariant.
if value is None:
return None
return "Internal server error"


def _sanitize_response_errors(value: Any) -> Any:
"""Copy a client response tree and remove persisted diagnostic messages."""
if isinstance(value, dict):
sanitized: Dict[Any, Any] = {}
for key, item in value.items():
if key in {"error", "error_message"}:
sanitized[key] = _client_safe_error(item)
elif key == "errors":
sanitized[key] = _sanitize_error_list(item)
else:
sanitized[key] = _sanitize_response_errors(item)
return sanitized
if isinstance(value, list):
return [_sanitize_response_errors(item) for item in value]
if isinstance(value, tuple):
return tuple(_sanitize_response_errors(item) for item in value)
return value


# Pydantic models for API requests/responses
class CloudVideoProcessingRequest(BaseModel):
Expand Down Expand Up @@ -133,12 +177,12 @@ async def process_video_cloud(
video_url=result.video_url,
success=result.success,
status='completed' if result.success else 'failed',
metadata=result.metadata,
transcript=result.transcript,
ai_analysis=result.ai_analysis,
metadata=_sanitize_response_errors(result.metadata),
transcript=_sanitize_response_errors(result.transcript),
ai_analysis=_sanitize_response_errors(result.ai_analysis),
processing_time=result.processing_time,
from_cache=result.from_cache,
error=result.error_message,
error=_client_safe_error(result.error_message),
)

except Exception as e:
Expand Down Expand Up @@ -218,8 +262,8 @@ async def process_video_task_handler(
status='failed',
error_message="Task processing failed"
)
except Exception as state_error:
logger.error(f"Failed to update error state: {state_error}")
except Exception:
logger.error("Failed to update error state", exc_info=True)

raise HTTPException(status_code=500, detail="Internal server error")

Expand Down Expand Up @@ -280,7 +324,7 @@ async def get_video_status(video_id: str):
created_at=state.created_at,
updated_at=state.updated_at,
processing_time=state.processing_time,
error_message=state.error_message,
error_message=_client_safe_error(state.error_message),
)

except HTTPException:
Expand Down Expand Up @@ -312,13 +356,13 @@ async def get_video_result(video_id: str):
"video_url": state.video_url,
"status": state.status,
"current_stage": state.current_stage,
"metadata": state.metadata,
"transcript": state.transcript,
"ai_analysis": state.ai_analysis,
"metadata": _sanitize_response_errors(state.metadata),
"transcript": _sanitize_response_errors(state.transcript),
"ai_analysis": _sanitize_response_errors(state.ai_analysis),
"processing_time": state.processing_time,
"created_at": state.created_at,
"updated_at": state.updated_at,
"error_message": state.error_message,
"error_message": _client_safe_error(state.error_message),
}

except HTTPException:
Expand All @@ -345,11 +389,11 @@ async def get_queue_stats():
"timestamp": datetime.now(timezone.utc).isoformat(),
}

except Exception as e:
logger.error(f"Error getting queue stats: {e}")
except Exception:
logger.error("Error getting queue stats", exc_info=True)
return {
"success": False,
"error": str(e),
"error": "Internal server error",
"timestamp": datetime.now(timezone.utc).isoformat(),
}

Expand All @@ -372,10 +416,11 @@ async def get_cloud_status():
"status": "operational",
"enabled": True,
}
except Exception as e:
except Exception:
logger.error("firestore status check failed", exc_info=True)
status["services"]["firestore"] = {
"status": "error",
"error": str(e),
"error": "Service unavailable",
}
status["overall_status"] = "degraded"

Expand All @@ -388,10 +433,11 @@ async def get_cloud_status():
"enabled": True,
"queue_stats": stats,
}
except Exception as e:
except Exception:
logger.error("cloud_tasks status check failed", exc_info=True)
status["services"]["cloud_tasks"] = {
"status": "error",
"error": str(e),
"error": "Service unavailable",
}
status["overall_status"] = "degraded"

Expand All @@ -402,20 +448,21 @@ async def get_cloud_status():
"status": "operational",
"enabled": True,
}
except Exception as e:
except Exception:
logger.error("vertex_ai status check failed", exc_info=True)
status["services"]["vertex_ai"] = {
"status": "error",
"error": str(e),
"error": "Service unavailable",
}
status["overall_status"] = "degraded"

return status

except Exception as e:
logger.error(f"Error getting cloud status: {e}")
except Exception:
logger.error("Error getting cloud status", exc_info=True)
return {
"overall_status": "error",
"error": str(e),
"error": "Internal server error",
"timestamp": datetime.now(timezone.utc).isoformat(),
}

Expand Down
Loading
Loading