Resolve merge conflicts with main#34
Merged
Merged
Conversation
4 tasks
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/affa5959-e553-45b8-96e7-f804589f3059 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/affa5959-e553-45b8-96e7-f804589f3059 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/affa5959-e553-45b8-96e7-f804589f3059 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/affa5959-e553-45b8-96e7-f804589f3059 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/affa5959-e553-45b8-96e7-f804589f3059 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/affa5959-e553-45b8-96e7-f804589f3059 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/affa5959-e553-45b8-96e7-f804589f3059 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Revamp threat detection to two-phase structured-output
Add two-phase structured-output threat detection via /reflect
May 7, 2026
This was referenced May 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a two-phase threat-detection flow to threat-detect, using a fast structured-output triage via api-proxy /reflect before falling back to the existing full detector when triage is suspicious or inconclusive. It also formalizes a strict structured result contract (schema + validation) and extends engine support to dynamically select /reflect models based on advertised structured-output capabilities.
Changes:
- Introduces Phase 1 triage prompt construction with bounded artifact inlining, plus a strict structured result schema/parser.
- Adds a
/reflectclient with model discovery/capability selection and provider-specific structured-output request shaping. - Updates CLI flags/env vars plus docs/spec to describe two-phase fail-safe behavior and structured-output requirements.
Show a summary per file
| File | Description |
|---|---|
| specs/threat-detection-spec.md | Documents two-phase default behavior, fail-safe semantics, and structured-output requirements. |
| README.md | Adds CLI flags/env vars for triage + /reflect, and explains default two-phase flow. |
| pkg/engine/reflect.go | Implements /reflect HTTP client: model discovery, request shaping, structured parsing, retries. |
| pkg/engine/reflect_test.go | Adds tests for model selection, request shapes, parsing/retry behavior. |
| pkg/engine/engine.go | Adds DefaultReflectURL constant for local /reflect. |
| pkg/engine/capabilities.go | Adds capability parsing + structured-mode selection for /reflect advertised models. |
| pkg/detector/triage.go | Adds bounded artifact inlining and triage prompt builder (Phase 1). |
| pkg/detector/triage_test.go | Tests triage prompt inlining/truncation and bundle metadata handling. |
| pkg/detector/result.go | Adds strict structured-result schema, parser/validator, and IsSafe helper. |
| pkg/detector/result_test.go | Adds strict structured-result parsing tests. |
| pkg/detector/prompts/threat_detection_triage.md | Adds the non-agentic triage prompt template with strict JSON-only output rules. |
| pkg/detector/detector.go | Extends embedded prompts to include the triage prompt template. |
| pkg/detector/correction.go | Adds bounded correction-feedback helpers for retry prompts. |
| cmd/threat-detect/main.go | Orchestrates two-phase flow, adds triage/reflect CLI flags & retry logic for full detector parsing. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 14/14 changed files
- Comments generated: 3
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/d9bcbb5d-ff2a-436a-9cee-3328587c44e1 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/d9bcbb5d-ff2a-436a-9cee-3328587c44e1 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/d9bcbb5d-ff2a-436a-9cee-3328587c44e1 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/d9bcbb5d-ff2a-436a-9cee-3328587c44e1 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/d9bcbb5d-ff2a-436a-9cee-3328587c44e1 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/14c8c39e-57ca-4f32-8ff3-20c067920367 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/14c8c39e-57ca-4f32-8ff3-20c067920367 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw-threat-detection/sessions/14c8c39e-57ca-4f32-8ff3-20c067920367 Co-authored-by: davidslater <12449447+davidslater@users.noreply.github.com>
Copilot
AI
changed the title
Add two-phase structured-output threat detection via /reflect
Verify /reflect fallback to agentic detection
May 13, 2026
Copilot
AI
changed the title
Verify /reflect fallback to agentic detection
Resolve merge conflicts with main
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix
What was the bug?
The branch conflicted with latest
main, blocking clean integration.How did you fix it?
README conflict resolution
/reflectfallback documentation with main’s engine CLI guidance./reflectstructured detection fallback behavior.Main branch updates
main.Testing
Validated the resolved merge with the existing repository checks.