inital#7
Closed
sksingh2005 wants to merge 1 commit into
Closed
Conversation
Owner
Author
|
@codex review |
There was a problem hiding this comment.
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
StackTraceExtractorutility to extract and normalize stack traces from email bodies and attachments. - Updated
IncomingEmailServiceto 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; | ||
| } |
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.
No description provided.