Agent-Hellboy / Agent-Hellboy/hcp

Improvements and Stability Enhancements for `run_service`

Aperta
#5 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
9
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

This task tracks potential issues and enhancements to make the clipboard service more robust and efficient.

## Must do
---

### Optimize `load_clipboard_blocks()` Behavior
- [ ] Avoid loading full history into memory (Must do)
- [ ] Refactor to load only the most recent clipboard entry (if needed) limit is not there , even for 15 entry it could go upto 15*16MB
- [ ] Consider using an indexed history format in the future

### Handle Disk Write Failures Gracefully
- [ ] Log any disk I/O errors encountered during write

### Ensure Clipboard Encoding Safety
- [ ] Validate that clipboard content is valid UTF-8
- [ ] Handle non-text clipboard formats gracefully
- [ ] Prevent crash/log error for invalid encoding

---

## Maybe

### Improve Duplicate Detection Logic
- [ ] Normalize clipboard entries before comparison (e.g., trim, decode HTML)
- [ ] Handle rich-text vs plain-text edge cases (if applicable)

### Reduce CPU Usage
- [x] Investigate event-driven clipboard tracking (e.g., X11 selection events)
- [x] Evaluate increasing the polling interval based on system usage

### Enforce Maximum Clipboard Size or History Limit
- [x] Add a maximum allowed size per clipboard entry (e.g., 1MB)
- [ ] Implement optional file rotation or pruning of history
- [ ] Log when an oversized entry is ignored

### Prepare for Future Concurrency
- [ ] Add mutex guard around clipboard read/write operations
- [ ] Consider file-level locking if multiple processes are introduced
- [ ] Add test to simulate concurrent writes

### Graceful Exit Handling
- [ ] Add signal handlers for `SIGINT` and `SIGTERM`
- [ ] Break the infinite loop on signal reception
- [ ] Ensure any pending write is flushed before exit
- [ ] Log shutdown event cleanly

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.