Skip to content

feat: Give LLM date context for security reviews - #143

Merged
dkorecko merged 1 commit into
mainfrom
feature/date-context
Jul 1, 2026
Merged

dkorecko merged 1 commit into
mainfrom
feature/date-context

Conversation

@dkorecko

@dkorecko dkorecko commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added support for optional system-level guidance in prompt-based AI requests, improving how responses can be shaped.
    • Updated diff analysis to include the current date in the prompt context, helping produce more time-aware assessments.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

OllamaService's prompt-sending methods (SendPrompt, SendPromptWithChunking) now accept an optional systemPrompt parameter, forwarded into the Ollama request payload and through chunked calls. AnalyzeDiff computes today's UTC date and appends a date-aware system prompt when invoking SendPromptWithChunking.

Changes

System Prompt Support in OllamaService

Layer / File(s) Summary
SendPrompt system prompt parameter
PatchPanda.Web/Services/OllamaService.cs
SendPrompt<T> accepts an optional systemPrompt parameter and includes it as system in the Ollama request payload.
Chunking pipeline propagation
PatchPanda.Web/Services/OllamaService.cs
SendPromptWithChunking<T> gains an optional systemPrompt parameter, forwarded to the single-pass, per-chunk, and final consolidation calls to SendPrompt<T>.
Date-aware analysis prompt
PatchPanda.Web/Services/OllamaService.cs
AnalyzeDiff computes today's UTC date and builds a system prompt embedding it, passed into SendPromptWithChunking.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant OllamaService
    participant OllamaAPI

    Caller->>OllamaService: AnalyzeDiff(diff)
    OllamaService->>OllamaService: compute today (UTC)
    OllamaService->>OllamaService: build systemPrompt with today
    OllamaService->>OllamaService: SendPromptWithChunking(prompt, systemPrompt)
    loop each chunk
        OllamaService->>OllamaAPI: SendPrompt(chunkPrompt, systemPrompt)
        OllamaAPI-->>OllamaService: chunk result
    end
    OllamaService->>OllamaAPI: SendPrompt(finalPrompt, systemPrompt)
    OllamaAPI-->>OllamaService: consolidated result
    OllamaService-->>Caller: analysis result
Loading

Poem

A rabbit hops with dates in tow, 🐇
"system" whispered soft and low,
Chunks now carry context true,
From dawn's UTC to prompt anew,
Hop, hop, hooray — the code review!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding date context to LLM security review prompts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/date-context

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@PatchPanda.Web/Services/OllamaService.cs`:
- Line 199: The date formatting in OllamaService should use an invariant culture
so the prompt always gets a consistent ISO date string regardless of host locale
settings. Update the DateTime.UtcNow.ToString call in the relevant method of
OllamaService to use the CultureInfo.InvariantCulture overload, keeping the
existing yyyy-MM-dd format.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8398c3af-28c4-44bf-b03b-38c048591bfa

📥 Commits

Reviewing files that changed from the base of the PR and between 7c9dc99 and bbdac4b.

📒 Files selected for processing (1)
  • PatchPanda.Web/Services/OllamaService.cs

Comment thread PatchPanda.Web/Services/OllamaService.cs
@dkorecko
dkorecko merged commit aa00899 into main Jul 1, 2026
6 checks passed
@dkorecko
dkorecko deleted the feature/date-context branch July 1, 2026 17:08
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.

1 participant