Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
80576b3
Priority rules: escalate sooner, exit codes in the CLI, a fourth seed…
Code-delta-support Sep 18, 2026
e5a81a8
Priority rules: a stale-ticket check for the age band
Code-delta-support Sep 28, 2026
625664b
Priority rules: hours left before the stale-ticket limit
Code-delta-support Oct 1, 2026
0bd6bdd
Priority rules: flag tickets close to the stale-ticket limit
Code-delta-support Oct 1, 2026
1471784
Priority rules: an overdue check, a day past the stale-ticket limit
Code-delta-support Oct 6, 2026
953b29c
Priority rules: hours past the stale-ticket limit
Code-delta-support Oct 9, 2026
23aeed8
Merge main (demo README figures, backup.env wording) into visitor-tes…
Code-delta-support Oct 9, 2026
edabf1f
Merge main (image samples) into visitor-test-2.1.1
Code-delta-support Oct 9, 2026
0124dd1
Priority rules: whole days past the stale-ticket limit
Code-delta-support Oct 9, 2026
2581115
Priority rules: a week past the stale-ticket limit
Code-delta-support Oct 10, 2026
bb1b8a1
Merge remote-tracking branch 'origin/main' into visitor-test-2.1.1
Code-delta-support Oct 12, 2026
d0821fd
Priority: first age bump after 12 hours
Code-delta-support Oct 12, 2026
a077c81
Priority: top age bump after 48 hours
Code-delta-support Oct 13, 2026
e1bdd3f
Test: review-cycle churn branch of the Action
Code-delta-support Oct 17, 2026
5e030d4
Priority: trailing newline
Code-delta-support Oct 17, 2026
3ef45b6
Back to the published Action (v1)
Code-delta-support Oct 17, 2026
6badb63
Test: rename a PR file; folder-only job
Code-delta-support Oct 17, 2026
1af873d
Back to the published Action (v1); test rename undone
Code-delta-support Oct 17, 2026
606fbe0
Test: Post-review churn rename on the Action test branch
Code-delta-support Oct 17, 2026
b5a1563
Back to the published Action (v1)
Code-delta-support Oct 17, 2026
eba39c0
Priority: due within the next day
Code-delta-support Oct 19, 2026
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
4 changes: 3 additions & 1 deletion agent-scan-demo/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: test lint build clean
.PHONY: test lint build clean check

PY ?= python3

Expand All @@ -13,6 +13,8 @@ build:
$(PY) -c "import helpdesk; print('helpdesk', helpdesk.__version__)"
cd cli && go build ./...

check: lint test

clean:
find . -name '__pycache__' -type d -prune -exec rm -rf {} +
find . -name '*.pyc' -delete
Expand Down
5 changes: 3 additions & 2 deletions agent-scan-demo/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func main() {
switch os.Args[1] {
case "list":
for _, t := range ts.ListOpen() {
fmt.Printf("#%d [P%d] %s\n", t.ID, t.Priority, t.Subject)
fmt.Printf("#%04d P%d %s\n", t.ID, t.Priority, t.Subject)
}
case "show":
fs := flag.NewFlagSet("show", flag.ExitOnError)
Expand All @@ -29,7 +29,8 @@ func main() {
if t, ok := ts.Get(*id); ok {
fmt.Printf("#%d %s\nStatus: %s\n\n%s\n", t.ID, t.Subject, t.Status, t.Body)
} else {
fmt.Println("no such ticket")
fmt.Fprintln(os.Stderr, "no such ticket")
os.Exit(1)
}
case "close":
fs := flag.NewFlagSet("close", flag.ExitOnError)
Expand Down
17 changes: 17 additions & 0 deletions agent-scan-demo/helpdesk/auto_close.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Synthetic, non-working sample for the CodeDelta demo. Never executed.
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
"""Auto-close: ask a model which stale tickets to close, then run what it says."""
import subprocess

from openai import OpenAI

client = OpenAI()


def close_stale(tickets):
listing = "\n".join(f"{t.id}: {t.subject}" for t in tickets)
reply = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Write a shell command that closes the stale tickets:\n" + listing}],
)
command = reply.choices[0].message.content
subprocess.run(command, shell=True)
51 changes: 49 additions & 2 deletions agent-scan-demo/helpdesk/priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"fails": 2,
"error": 1,
"slow": 1,
"timeout": 2,
"broken": 2,
"security": 3,
"data loss": 3,
Expand All @@ -29,8 +30,54 @@ def score_priority(subject: str, body: str, age_hours: float = 0.0) -> int:

# Older unresolved tickets escalate.
if age_hours >= 48:
raw += 2
elif age_hours >= 12:
raw += 1
elif age_hours >= 24:
raw += 0

return max(0, min(MAX_SCORE, raw))


def is_escalated(subject: str, body: str, age_hours: float = 0.0) -> bool:
"""True when a ticket has reached the top band."""
return score_priority(subject, body, age_hours) >= MAX_SCORE


def is_stale(age_hours: float, limit_hours: float = 72.0) -> bool:
"""True when a ticket has waited longer than the service limit."""
return age_hours > limit_hours


def hours_until_stale(age_hours: float, limit_hours: float = 72.0) -> float:
"""Hours left before a ticket passes the service limit (0 once it has)."""
return max(0.0, limit_hours - age_hours)


def is_due_soon(age_hours: float, limit_hours: float = 72.0, window_hours: float = 12.0) -> bool:
"""True when a ticket will pass the service limit within the window."""
return 0.0 < hours_until_stale(age_hours, limit_hours) <= window_hours


def is_overdue(age_hours: float, limit_hours: float = 72.0) -> bool:
"""True once a ticket has passed the service limit by more than a day."""
return age_hours > limit_hours + 24.0


def hours_overdue(age_hours: float, limit_hours: float = 72.0) -> float:
"""Hours a ticket has spent past the service limit (0 until it passes)."""
return max(0.0, age_hours - limit_hours)


def days_overdue(age_hours: float, limit_hours: float = 72.0) -> float:
"""Whole days a ticket has spent past the service limit."""
return hours_overdue(age_hours, limit_hours) // 24.0


def is_long_overdue(age_hours: float, limit_hours: float = 72.0) -> bool:
"""True once a ticket is a full week past the service limit."""
return days_overdue(age_hours, limit_hours) >= 7.0



def is_due_today(age_hours: float, limit_hours: float = 72.0) -> bool:
"""True when a ticket reaches its service limit within the next day."""
return 0.0 <= limit_hours - age_hours < 24.0
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ public record TicketDto(long id, String subject, String status, int priority) {}

private final List<TicketDto> tickets = new ArrayList<>(List.of(
new TicketDto(1, "Login fails", "open", 2),
new TicketDto(2, "Export broken", "open", 1),
new TicketDto(3, "Feature request", "open", 0)
new TicketDto(2, "Export broken", "open", 2),
new TicketDto(3, "Feature request", "open", 0),
new TicketDto(4, "Password reset loop", "open", 3)
));

@GetMapping
Expand Down
22 changes: 0 additions & 22 deletions agent-scan-demo/tests/test_priority.py

This file was deleted.

17 changes: 17 additions & 0 deletions agent-scan-demo/tests/test_priority_rules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Priority rules: keyword bands and age escalation."""
from helpdesk.priority import score_priority, is_escalated


def test_keyword_sets_the_band():
assert score_priority("Site is down", "") == 3
assert score_priority("Small typo", "") == 0


def test_age_escalates():
assert score_priority("Slow page", "", age_hours=30) == 2
assert score_priority("Slow page", "", age_hours=80) == 3


def test_is_escalated():
assert is_escalated("Outage in EU", "")
assert not is_escalated("Question about billing", "")
Loading