anthropics / anthropics/claude-code-action

Stop warning about future dates in code

Aperta
#798 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug p3
Lingua principale
TypeScript
Stelle
8.9k
Fork
2.1k
Merge medio
3g 9h
PR unite (30g)
10

Descrizione

**Describe the bug**

A one-shot PR review prompt via a Github Action may report seeing "future dates" that are actually just "today" and mark it as a critical issue to resolve.

Example Claude Code output from a real PR review

```
🔴 Critical
Future date in comments (lines with @modified 2026-01-07):

The modification date is set to 2026, which is in the future. This should be 2025-01-07 or the actual modification date.

```

**To Reproduce**

1. Setup a Github Action PR with user prompt:

````
Review this pull request:

PR #{pr_number}: {pr_title}

Description:
{pr_body}

Code Changes:
```diff
{diff}
```

Please provide a concise code review including:
1. **Summary**: Brief overview of the changes
2. **Issues**: Any bugs, errors, or potential problems
3. **Suggestions**: Improvements or optimizations
4. **Security**: Any security considerations

Keep the review focused and actionable.
````

2. Make some change that includes a `@modified YYYY-MM-DD` in a docblock or similar.
3. Push a PR.

**Expected behavior**

Claude Code reviews default system prompt should be grounded in a way as to not mark temporal information in code as a "Critical" error found in a PR review.

For now, my workaround is to attempt to supply my own system prompt to pass in the current date ISO and Timezone, and adding some custom grounding instructions for date-based issues:

````
### Date & time handling (important)
- CURRENT_DATETIME is authoritative: {current_datetime_iso}
- TIMEZONE is: {timezone_label}
- Do NOT flag date/time issues unless the provided context explicitly touches date/time logic
(parsing, formatting, comparison, scheduling, timezones, clocks)
OR includes explicit date literals or annotations.
- Never speculate about what a date “should” be unless the provided context itself defines a rule.
- If a date concern is not provable from the provided context, treat it as a Potential concern and include a Verify by checklist.
````

Here is my full custom system prompt that I'm using to workaround date hallucination in PR reviews:
https://gist.github.com/jameswilson/a8c8062a8d41bd56bb81f64297b8dca9

**API Provider**

[x] Anthropic First-Party API (default)
[ ] AWS Bedrock
[ ] GCP Vertex

**Additional context**

It is possible this issue is already handled by the `claude-code-action` system prompt and if so, feel free to close this issue!

Context: I'm not currently using the `claude-code-action` action, but instead using a custom-written github action with py script that calls the API directly using the Anthropic Python lib. I just didn't know where else to report this! Thanks!

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.