Skip to content

Commit

Permalink
feedback stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jennmueng committed Jun 7, 2024
1 parent cd3887b commit 27d6c85
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/seer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
AutofixEndpointResponse,
AutofixPrIdRequest,
AutofixRequest,
AutofixStateOptions,
AutofixStateRequest,
AutofixStateResponse,
AutofixUpdateRequest,
Expand Down Expand Up @@ -213,6 +214,11 @@ def get_autofix_state_endpoint(data: AutofixStateRequest) -> AutofixStateRespons
if state:
check_and_mark_if_timed_out(state)

with state.update() as cur:
if not cur.options:
cur.options = AutofixStateOptions()
cur.options.iterative_feedback = True # Enable iterative feedback even on older runs

return AutofixStateResponse(
group_id=data.group_id, state=state.get().model_dump(mode="json") if state else None
)
Expand Down
8 changes: 7 additions & 1 deletion src/seer/automation/autofix/event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,15 @@ def set_selected_root_cause(self, selection: RootCauseSelection):

cur.status = AutofixStatus.PROCESSING

def send_planning_start(self, is_update: bool = False):
def send_planning_start(self, is_update: bool = False, is_retry: bool = False):
with self.state.update() as cur:
if is_retry:
last_step = cur.steps[-1]
if last_step.key == self.plan_step.key:
del cur.steps[-1]

plan_step = cur.last_or_add(self.plan_step)

plan_step.status = AutofixStatus.PROCESSING

if is_update:
Expand Down
6 changes: 6 additions & 0 deletions src/seer/automation/autofix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ class CodebaseState(BaseModel):
file_changes: list[FileChange] = []


class AutofixStateOptions(BaseModel):
iterative_feedback: bool | None = False


class AutofixGroupState(BaseModel):
run_id: int = -1
steps: list[Step] = Field(default_factory=list)
Expand All @@ -190,6 +194,7 @@ class AutofixGroupState(BaseModel):
completed_at: datetime.datetime | None = None
signals: list[str] = Field(default_factory=list)
actor_ids: list[int] = Field(default_factory=list)
options: AutofixStateOptions | None = Field(default=AutofixStateOptions())


class AutofixStateRequest(BaseModel):
Expand Down Expand Up @@ -259,6 +264,7 @@ class AutofixRootCauseUpdatePayload(BaseModel):
cause_id: int | None = None
fix_id: int | None = None
custom_root_cause: str | None = None
is_retry: bool | None = False


class AutofixCreatePrUpdatePayload(BaseModel):
Expand Down
6 changes: 3 additions & 3 deletions src/seer/automation/autofix/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ def run_autofix_execution(request: AutofixUpdateRequest):
with state.update() as cur:
cur.mark_triggered()

event_manager = AutofixEventManager(state)
event_manager.send_planning_start()

payload = cast(AutofixRootCauseUpdatePayload, request.payload)

event_manager = AutofixEventManager(state)
event_manager.send_planning_start(is_retry=payload.is_retry or False)

try:
root_cause: CustomRootCauseSelection | SuggestedFixRootCauseSelection | None = None
if payload.custom_root_cause:
Expand Down

0 comments on commit 27d6c85

Please sign in to comment.