aws / aws/amazon-q-developer-cli

Bug: Agent Violates "Never Hardcode" Rule When Generating Tools and Scripts

Aperta
#3,553 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
2k
Fork
439
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

# Bug: Agent Violates "Never Hardcode" Rule When Generating Tools and Scripts

**Note:** This issue affects Kiro CLI agent code generation practices.

## Problem

* Agents generate tools and scripts with hardcoded values despite explicit "never hardcode" instructions
* Session management tools contain hardcoded project names, work types, and content templates
* Generated code violates fundamental coding best practices and creates misleading outputs
* Scripts fail to detect current project context or work being performed
* Results in multiple incorrect session documents when tool is reused across projects

## Proposed Solution

Add enforcement mechanisms to prevent hardcoding in agent-generated code:

```javascript
// Instead of hardcoded values
const projectName = "SpecificProject";
const workType = "Security Audit";

// Should generate dynamic detection
const projectName = detectCurrentProject();
const workType = analyzeCurrentWork();
```

Implement validation checks that:
* Detect hardcoded strings in generated code
* Suggest dynamic alternatives
* Warn when context-specific values are embedded

## Benefits

* Ensures agent-generated tools work correctly across different projects
* Maintains coding best practices and golden rules
* Prevents misleading documentation and context pollution
* Creates reusable, context-aware tooling
* Reduces need for manual fixes and regeneration

## Alternatives Considered

* Manual code review (doesn't scale with agent usage)
* Post-generation fixes (reactive rather than preventive)
* User-side validation (places burden on users to catch violations)

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

L’issue non indica file, test o punti di ingresso; inizia individuando l’implementazione della generazione del codice dell’agente e della gestione delle sessioni. Definisci prima un caso riproducibile tra progetti e l’ambito della convalida; il lavoro sarà completato quando verranno rilevati i valori hardcoded specifici del contesto e gli strumenti generati avviseranno o useranno un contesto dinamico.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
ai, cli, tooling
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.