Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More telemetry #1008

Merged
merged 9 commits into from
Jun 13, 2024
Merged

More telemetry #1008

merged 9 commits into from
Jun 13, 2024

Conversation

senko
Copy link
Contributor

@senko senko commented Jun 11, 2024

This PR fixes system dependency checks to be done even if example project is started, and to wait for user confirmation before continuing. It also stores the information on whether the dependency is installed or not in telemetry data.

It also disables telemetry in unit tests and adds new trace events for:

  • project creation
  • spec writer
  • task start and end
  • checked system dependencies
  • number of tasks in a dev plan
  • stuck in loop clicked

@gperetin gperetin requested a review from LeonOstrez June 11, 2024 18:45
@gperetin gperetin marked this pull request as ready for review June 11, 2024 18:45
Copy link
Member

@LeonOstrez LeonOstrez left a comment

Choose a reason for hiding this comment

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

We should also review TELEMETRY.md to see if it has to be updated.

@@ -25,5 +26,8 @@ async def run(self) -> AgentResponse:
self.current_state.get_source_index(source),
tasks,
)
await telemetry.trace_code_event(
"task-end", {"task-num": current_task_index1, "num-iterations": len(self.current_state.iterations)}
Copy link
Member

Choose a reason for hiding this comment

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

we should either update how trace_code_event works or add data to each trace. Here are some suggestions of what data might be useful:

  • number of epics (is it the initial app or feature?)
  • number of all tasks (is it the last task? Could be that we have most iterations on the last task because everyone clicks "continue" until it is the last task)
  • some data so we can find and analyze the db

@@ -4,6 +4,7 @@

from core.agents.base import BaseAgent
from core.agents.convo import AgentConvo
from core.agents.mixins import SystemDependencyCheckerMixin
Copy link
Member

Choose a reason for hiding this comment

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

In my opinion, we shouldn't use this as mixin. We should always go though whole flow and each agent should do it's own job.

@@ -195,6 +196,7 @@ async def breakdown_current_task(self) -> AgentResponse:
self.next_state.modified_files = {}
self.set_next_steps(response, source)
self.next_state.action = f"Task #{current_task_index + 1} start"
await telemetry.trace_code_event("task-start", {"task-num": current_task_index + 1})
Copy link
Member

Choose a reason for hiding this comment

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

add:

  • number of epics
  • total number of tasks

@@ -53,6 +54,14 @@ async def run(self) -> AgentResponse:
spec = response.text

complexity = await self.check_prompt_complexity(spec)
await telemetry.trace_code_event(
Copy link
Member

Choose a reason for hiding this comment

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

add

  • initial project description (before spec writer)

@@ -129,12 +135,21 @@ async def analyze_spec(self, spec: str) -> str:
buttons={"continue": "continue"},
)
if confirm.cancelled or confirm.button == "continue" or confirm.text == "":
await self.telemetry.trace_code_event(
"spec-writer-questions",
{
Copy link
Member

Choose a reason for hiding this comment

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

add:

  • initial user description (before spec writer)

@@ -151,6 +152,7 @@ async def plan_epic(self, epic) -> AgentResponse:
}
for task in response.plan
]
await telemetry.trace_code_event("development-plan", {"num-tasks": len(response.plan)})
Copy link
Member

Choose a reason for hiding this comment

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

add:

  • number of epics (is it the initial app or feature?)

@@ -182,6 +182,7 @@ async def get_user_feedback(
return False, False, ""

if user_response.button == "loop":
await telemetry.trace_code_event("stuck-in-loop", {"clicked": True})
Copy link
Member

Choose a reason for hiding this comment

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

add:

  • number of epics (is it the initial app or feature?)
  • number of all tasks (is it the last task? Could be that we have most iterations on the last task because everyone clicks "continue" until it is the last task)
  • current task index
  • some data so we can find and analyze the db
  • number of iterations
  • number of steps
  • tech stack? Then we can see easily on which stack is this button used the most

@senko
Copy link
Contributor Author

senko commented Jun 13, 2024

@LeonOstrez comments addressed in the 4 new commits (recommend checking one by one)

Example project and package installation status info in final telemetry event:

Screenshot from 2024-06-13 10-33-13

Extra data in trace events:

Screenshot from 2024-06-13 13-51-26

Also, instead of SpecWriter handling everything for an example project, each agent now does its part:

[core.agents.orchestrator] Running agent SpecWriter (step 1)
[core.agents.spec_writer] Starting example project: example-project
[core.agents.orchestrator] Agent SpecWriter is done, committing state for step 1: 0/0 epics, 0/0 tasks, 0/0 iterations, 0/0 dev steps.
[core.agents.orchestrator] Running agent Architect (step 1)
[core.agents.architect] Setting architecture for example project: example-project
[core.proc.process_manager] Starting process: node --version (cwd=/home/senko/Projects/Pythagora/gpt-pilot/workspace/demo-020922a)
[core.agents.orchestrator] Agent Architect is done, committing state for step 1: 0/0 epics, 0/0 tasks, 0/0 iterations, 0/0 dev steps.
[core.db.session] Connected to database sqlite+aiosqlite:///pythagora.db
[core.agents.orchestrator] Running agent TechLead (step 2)
[core.agents.tech_lead] Planning example project: example-project
[core.agents.orchestrator] Agent TechLead is done, committing state for step 2: 0/1 epics, 0/1 tasks, 0/0 iterations, 0/0 dev steps.
[core.db.session] Connected to database sqlite+aiosqlite:///pythagora.db
[core.agents.orchestrator] Running agent TechLead (step 3)
[core.agents.tech_lead] Applying project template: javascript_react
[core.templates.registry] Applying project template javascript_react...
[core.agents.orchestrator] Agent TechLead is done, committing state for step 3: 0/1 epics, 0/1 tasks, 0/0 iterations, 0/0 dev steps.
[core.agents.orchestrator] Running agent ExternalDocumentation (step 4)
[core.agents.external_docs] Example project detected, no documentation selected.

As as side-effect, this also allows future expansion to add more/different example projects.

@senko senko requested a review from LeonOstrez June 13, 2024 12:14
@LeonOstrez LeonOstrez merged commit 5463c59 into main Jun 13, 2024
6 checks passed
@LeonOstrez LeonOstrez deleted the more-telemetry branch June 13, 2024 13:26
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.

3 participants