Skip to content

Support listing and deleting recorded agent actions - #6571

Open
ayoubdiourin7 wants to merge 8 commits into
mozilla:masterfrom
ayoubdiourin7:feature/manage-agent-actions
Open

Support listing and deleting recorded agent actions#6571
ayoubdiourin7 wants to merge 8 commits into
mozilla:masterfrom
ayoubdiourin7:feature/manage-agent-actions

Conversation

@ayoubdiourin7

Copy link
Copy Markdown
Collaborator

Summary

  • Add tools for agents to list and remove actions recorded during the current run.
  • Assign stable action IDs so recorded actions can be referenced safely.
  • Enable the new recorded_actions tools for the bug-fix and frontend-triage agents.
  • Update prompts to explain when agents should review or retract recorded actions.
  • Add tests covering action listing, removal, unknown IDs, attachments, and final runtime summaries.

Fixes #6513

@ayoubdiourin7
ayoubdiourin7 requested review from a team as code owners August 11, 2026 16:09
Comment thread agents/frontend-triage/hackbot_agents/frontend_triage/prompts/system.md Outdated
Comment on lines +132 to +135
return [
{**copy.deepcopy(action), "action_id": action_id}
for action_id, action in self._actions.items()
]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would return MD table, with ID, Action (based on the tool name), and reasoning.


self._actions.append(action)
self._actions[action_id] = action
self._last_action_id = action_id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using _last_action_id is a bit fragile, race conditions could miss up with that.

``attachments`` key yet.
"""
idx = len(self._actions)
sequence = self._next_action_sequence

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, sequential IDs would be easy for the agent to guess and might remove things by accident. We could use UUIDs, which would be harder to guess.


def _confirm(recorder: ActionsRecorder, action_type: str) -> str:
return f"Recorded {action_type} (#{len(recorder.actions) - 1})."
return f"Recorded {action_type} as {recorder.last_action_id}."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return f"Recorded {action_type} as {recorder.last_action_id}."
return f"Recorded {action_type} (ID: {recorder.last_action_id})."


def _confirm(recorder: ActionsRecorder, action_type: str) -> str:
return f"Recorded {action_type} (#{len(recorder.actions) - 1})."
return f"Recorded {action_type} as {recorder.last_action_id}."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +32 to +33
"Exact stable ID returned when the action was recorded or by "
"list_actions (for example, action-2)."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would simplify it. Also, we do not need an example; it makes it a bit confusing since it does not look like the action IDs that will be in real cases.

Comment on lines +38 to +42
"""Retract one proposed action from this agent run.

The removed action will not appear in the final run summary and cannot be
applied. This operation accepts exactly one action ID and has no cascade or
force mode.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shorter the better.

Comment on lines +15 to +21
"""List every action currently proposed by this agent run.

Returns each action's stable in-run ID and its complete recorded payload,
including parameters, reasoning, references, and attachment metadata. Use
this when earlier action details are no longer present in your context or
before deciding whether a proposal needs to be retracted.
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shorter the better.

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.

Support managing the reported agent actions

2 participants