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

Fail when running PR-agent command on github action #151

Closed
hmstungtnt opened this issue Jul 28, 2023 · 4 comments
Closed

Fail when running PR-agent command on github action #151

hmstungtnt opened this issue Jul 28, 2023 · 4 comments
Assignees
Labels

Comments

@hmstungtnt
Copy link

hmstungtnt commented Jul 28, 2023

I install and run PR-agent command on an PR, but the github action fails, I attached the log of github action:

2023-07-28T04:26:31.3676488Z ##[command]/usr/bin/docker run --name bedb40892f5da3aed45acbef1944b5ef909ba_714136 --label 5bedb4 --workdir /github/workspace --rm -e "OPENAI_KEY" -e "GITHUB_TOKEN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/lzg.cmd.booking/lzg.cmd.booking":"/github/workspace" 5bedb4:0892f5da3aed45acbef1944b5ef909ba
2023-07-28T04:26:32.8597954Z Traceback (most recent call last):
2023-07-28T04:26:32.8598810Z   File "/usr/local/lib/python3.10/site-packages/starlette_context/ctx.py", line 31, in data
2023-07-28T04:26:32.8599516Z     return _request_scope_context_storage.get()
2023-07-28T04:26:32.8599982Z LookupError: <ContextVar name='starlette_context' at 0x7f8f4d717ab0>
2023-07-28T04:26:32.8600197Z 
2023-07-28T04:26:32.8600370Z During handling of the above exception, another exception occurred:
2023-07-28T04:26:32.8600584Z 
2023-07-28T04:26:32.8600684Z Traceback (most recent call last):
2023-07-28T04:26:32.8601019Z   File "/app/pr_agent/servers/github_action_runner.py", line 68, in <module>
2023-07-28T04:26:32.8601335Z     asyncio.run(run_action())
2023-07-28T04:26:32.8601644Z   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
2023-07-28T04:26:32.8601946Z     return loop.run_until_complete(main)
2023-07-28T04:26:32.8602297Z   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
2023-07-28T04:26:32.8602614Z     return future.result()
2023-07-28T04:26:32.8602925Z   File "/app/pr_agent/servers/github_action_runner.py", line 64, in run_action
2023-07-28T04:26:32.8603275Z     await PRAgent().handle_request(pr_url, body)
2023-07-28T04:26:32.8603627Z   File "/app/pr_agent/agent/pr_agent.py", line 24, in handle_request
2023-07-28T04:26:32.8603942Z     await PRReviewer(pr_url, args=args).review()
2023-07-28T04:26:32.8604267Z   File "/app/pr_agent/tools/pr_reviewer.py", line 35, in __init__
2023-07-28T04:26:32.8604648Z     self.git_provider = get_git_provider()(pr_url, incremental=self.incremental)
2023-07-28T04:26:32.8605048Z   File "/app/pr_agent/git_providers/github_provider.py", line 21, in __init__
2023-07-28T04:26:32.8605405Z     self.installation_id = context.get("installation_id", None)
2023-07-28T04:26:32.8605764Z   File "/usr/local/lib/python3.10/_collections_abc.py", line 824, in get
2023-07-28T04:26:32.8606046Z     return self[key]
2023-07-28T04:26:32.8606340Z   File "/usr/local/lib/python3.10/collections/__init__.py", line 1102, in __getitem__
2023-07-28T04:26:32.8606637Z     if key in self.data:
2023-07-28T04:26:32.8615691Z   File "/usr/local/lib/python3.10/site-packages/starlette_context/ctx.py", line 33, in data
2023-07-28T04:26:32.8616428Z     raise ContextDoesNotExistError
2023-07-28T04:26:32.8617285Z starlette_context.errors.ContextDoesNotExistError: You didn't use the required middleware or you're trying to access `context` object outside of the request-response cycle.```
@superwoou
Copy link

same here

@mrT23
Copy link
Collaborator

mrT23 commented Jul 28, 2023

@okotek we don't have the line 'self.installation_id = context.get("installation_id", None)' in the current main branch

maybe we need to update the docker ?

@mrT23
Copy link
Collaborator

mrT23 commented Jul 28, 2023

@hmstungtnt i believe it is fixed.
please try again, and thanks for the feedback

@okotek okotek added the fixed label Jul 28, 2023
@KalleV
Copy link

KalleV commented Jul 28, 2023

I came across this too. It went away after the latest changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants