Skip to content

inital#7

Closed
sksingh2005 wants to merge 1 commit into
mainfrom
feat/ticket-grouping
Closed

inital#7
sksingh2005 wants to merge 1 commit into
mainfrom
feat/ticket-grouping

Conversation

@sksingh2005

Copy link
Copy Markdown
Owner

No description provided.

@sksingh2005 sksingh2005 requested a review from Copilot May 19, 2026 21:31
@sksingh2005

Copy link
Copy Markdown
Owner Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces stack-trace detection and normalization to support de-duplicating incoming support emails: if a new email contains a stack trace matching a prior ticket for the same company, the system appends the message to the existing ticket, escalates its support level, and reopens it if needed.

Changes:

  • Added StackTraceExtractor utility to extract and normalize stack traces from email bodies and attachments.
  • Updated IncomingEmailService to detect duplicate stack traces, reuse the existing ticket, escalate it, and reopen when closed/resolved.
  • Added unit/integration tests covering stack trace extraction and the incoming-email deduplication/escalation behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/backend/main/java/ai/mnemosyne_systems/service/StackTraceExtractor.java New utility for extracting/normalizing stack traces from text and attachments.
src/backend/main/java/ai/mnemosyne_systems/service/IncomingEmailService.java Adds duplicate stack-trace lookup plus escalation/reopen behavior on incoming mail.
src/backend/test/java/ai/mnemosyne_systems/service/StackTraceExtractorTest.java New unit tests for extraction and normalization behavior.
src/backend/test/java/ai/mnemosyne_systems/resource/SupportAccessTest.java New integration test for incoming-email deduplication and escalation flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +227 to +235
List<Message> companyMessages = Message
.list("select m from Message m join m.ticket t where t.company = ?1 order by t.id desc", company);
for (Message m : companyMessages) {
if (m.body != null) {
List<String> traces = StackTraceExtractor.extractStackTraces(m.body);
for (String trace : traces) {
if (normalizedIncoming.contains(StackTraceExtractor.normalizeStackTrace(trace))) {
return m.ticket;
}
Comment on lines +240 to +246
List<Attachment> companyAttachments = Attachment.list(
"select a from Attachment a join a.message m join m.ticket t where t.company = ?1 order by t.id desc",
company);
for (Attachment a : companyAttachments) {
if (a.data != null) {
String text = new String(a.data, java.nio.charset.StandardCharsets.UTF_8);
List<String> traces = StackTraceExtractor.extractStackTraces(text);
Comment on lines +66 to +76
public static List<String> extractStackTracesFromAttachments(List<Attachment> attachments) {
List<String> traces = new ArrayList<>();
if (attachments == null) {
return traces;
}
for (Attachment attachment : attachments) {
if (attachment.data != null) {
String text = new String(attachment.data, StandardCharsets.UTF_8);
traces.addAll(extractStackTraces(text));
}
}
Comment on lines +779 to +781
Level normal = ensureLevel("Normal", "Normal response", 1440, "White");
Level escalate = ensureLevel("Escalate", "Escalate response", 120, "Yellow");
ensureCompanyEntitlement(company, entitlement, normal);
Comment on lines +29 to +36
// Look backward for exception/header line
String header = null;
if (i > 0) {
String prev = lines[i - 1].trim();
if (!isFrameLine(prev) && (prev.contains("Exception") || prev.contains("Error")
|| prev.contains("Throwable") || prev.contains("at "))) {
header = prev;
}
@sksingh2005 sksingh2005 deleted the feat/ticket-grouping branch June 15, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants