feat(04-03): add new-project callback support to handle_callback

- Add new-project action handling in handle_callback
- Supports Create New Project button from error cards
- Updates user context when project is created via callback
- Add 4 new tests in TestHandleCallback for new-project action

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 19:02:49 +08:00
parent 774e450ee3
commit b026096bfa
2 changed files with 119 additions and 6 deletions
+22 -6
View File
@@ -323,22 +323,38 @@ class Orchestrator:
)
def handle_callback(self, callback_data: Dict[str, Any]) -> Dict[str, Any]:
"""Handle a button callback from an approval card.
"""Handle a button callback from a card.
This processes approval/reject actions and sends the
response to the tmux session.
This processes various actions including:
- approve/reject: For approval workflows
- new-project: For creating new projects from error cards
Args:
callback_data: Dictionary containing:
- action: "approve" or "reject"
- approval_id: The ID of the approval
- project: The project name
- action: "approve", "reject", or "new-project"
- For approvals: approval_id, project
- For new-project: name, user_id
Returns:
Feishu Card JSON dict as confirmation response.
"""
try:
action = callback_data.get("action", "")
# Handle new-project action from error card button
if action == "new-project":
project_name = callback_data.get("name", "")
user_id = callback_data.get("user_id", "")
if not project_name:
return self.formatter.format_error(
title="Invalid Request",
content="Project name is required"
)
return self._handle_new_project(user_id, project_name)
# Handle approval/reject actions
approval_id = callback_data.get("approval_id", "")
project_name = callback_data.get("project", "default")