[UI-REWRITE] Add retention and cleanup for A2A task and event rows

Open
#7,797 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend, databases

Research direction

Start by reading a2a_service.py, config.py, db.py, and metrics_cleanup_service.py to understand task and event storage, retention settings, and the existing cleanup job. Trace how scheduled jobs are registered and how terminal tasks are identified. Add retention cleanup that respects the zero setting and logs deleted counts; verify old terminal tasks and their events are removed while in-window tasks and events remain.

Written by the indexing model from the issue text.

Description

a2a database triage ui-rewrite

Summary
a2a_tasks and a2a_task_events grow without limit. Every agent invocation upserts a task row, and each task event adds another (a2a_service.py). The task row holds the agent reply verbatim in payload and latest_message. config.py declares no retention setting for either table, and no job deletes old rows. Other row stores already have one, such as metrics_retention_days with metrics_cleanup_service.py, and observability_trace_retention_days.

Deleting a task does not delete its events. a2a_task_events.task_id is a plain string column, not a foreign key to a2a_tasks, so only an agent delete cascades (db.py).

Proposed changes

  • Add a retention setting in days for task rows and event rows.
  • Delete rows past the window on a scheduled job, following metrics_cleanup_service.py.
  • Delete the events of a deleted task in the same pass, since no cascade covers them.
  • Treat zero as disabled.
  • Log how many rows each pass deleted.

Acceptance criteria

  • The job deletes a terminal task older than the window, together with its events.
  • A task inside the window stays, together with its events.
  • A setting of zero deletes nothing.
  • Each pass logs the deleted row counts.
  • No orphan event rows remain for a deleted task.

Not included

  • Deleting a non-terminal task, which can still wait on the caller.
  • Export or archive before deletion.
  • Retention for push notification config rows.

Related issues: #7026, #7788, #7790, #5936

Dominant language
Python
Stars
4.9k
Forks
1k
Avg merge
3d 9h
Merged PRs (30d)
91

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from IBM/mcp-context-forge

All issues in IBM/mcp-context-forge

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.