-
Notifications
You must be signed in to change notification settings - Fork 378
feat: Enhance press-agent communication #6446
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
Open
20vikash
wants to merge
65
commits into
frappe:develop
Choose a base branch
from
20vikash:press_agent
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 22 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
eaef4c2
feat(server): Scaffold setup_agent_auth
20vikash b6454ef
feat(server): Generate ED25519 key pair, set private key to agent
20vikash d6e8876
feat(server): Playbook for agent auth
20vikash 567135f
feat(agent): Verify response token
20vikash 47d2b04
refactor(server): Use raw format for public key, pkcs for private
20vikash bc16af3
refactor(agent): Also verify response token in raw_request
20vikash 2db84d8
feat(server): Setup Agent Auth in proxy and database
20vikash 62628f5
fix(server): Move ED25519 key generation to BaseServer
20vikash d841835
feat(server): Update Proxy and Database DOCTYPE
20vikash f82609a
refactor(server): Move setup_agent_auth whitelist to BaseServer
20vikash 56a5522
feat(server): Setup Agent Auth in server setup time
20vikash 6c19b5c
fix(agent): Don't verify agent responses
20vikash f293457
feat(api): Verify agent in whitelists which agent requests
20vikash f5f4882
refactor(agent-job): Add agent type annotation to poll_random_jobs
20vikash 87e76f9
refactor(agent): Send agent signed long lived token
20vikash 3963c33
feat(agent): Schedule to check for token regeneration daily
20vikash df10f26
fix(agent-auth): Handle token regeneration edge cases
20vikash 6d72f95
feat(callback): Update status given by agent
20vikash 231704e
feat(agent-job): Publish realtime for each step
20vikash 956d8a4
refactor(agent-job): Move agent step publish into publish_update
20vikash ee77c1d
feat(agent-job): Retry schedule for undelivered jobs
20vikash 5019d32
feat(press-settings): Add feature flag for agent job push
20vikash 386b8b1
fix(agent-auth): Dual token window should match ansible timeout
20vikash 7089750
fix(agent-auth): Reload to avoid stale regenerate public key
20vikash 2ca8279
fix(agent): Validate callback token format
20vikash 0f1c0b9
fix(server): Check ansible status before setup equals 1
20vikash db8cff1
fix(server): Detach private key and attach agent token to playbook
20vikash fcd7d53
fix(server): Save agent auth in setup server
20vikash 82c95c0
fix(agent): Add validation for agent public keys
20vikash 6e9f1d6
refactor(callbacks): Increase rate limit from 10 to 500 for update job
20vikash 596671a
fix(server): Idempotent agent auth setup
20vikash 0d40b33
fix(callbacks): Add server to filter
20vikash f4bf67d
fix(callbacks): Check the instance of job
20vikash 62c2792
fix(agent-job): Remove undelivered jobs cache after its done
20vikash c364466
refactor(callbacks): Enqueue handle polled jobs
20vikash acd656a
fix(agent): Throw permission error if verification failed
20vikash ad03118
Merge remote-tracking branch 'upstream/develop' into press_agent
20vikash 2c18ae3
refactor(server): Reduce server on_update complexity
20vikash 7766468
feat(agent-auth): Add tests
20vikash 9cd1279
fix(test): Fix mock tests
20vikash f9fe94a
feat(test): Add more agent auth tests
20vikash afa304e
fix(test-server): Only mock cache.delete_key
20vikash dfdf8dc
fix(test): Test fixes
20vikash 450103d
fix(lint): Fix lint issues
20vikash bd1d17a
fix(server): Fix set db healthcheck
20vikash 0f7c045
fix(test-audit): Fix flaky backup audit by using relative timestamps
20vikash 29deace
revert(test-audit): Revert flaky test_audit changes
20vikash 1d07e4f
refactor(agent): Use HS256 and hand off retry and regenerate to agent
20vikash 5a77ccc
Merge branch 'develop' into press_agent
20vikash eb2ab59
fix(ruff): Fix ruff issues
20vikash 1997a5a
feat(agent): Add test cases
20vikash 90dec3a
fix(test): Add update_feature patch
20vikash 1de5014
fix(server): Ignore update_feature on tests
20vikash 3d64c7d
chore(server): Remove sync_database_server_public_status line
20vikash 3cd7f3d
fix(callbacks): Fix test cases
20vikash 5ce545a
chore(agent): Remove printing payload
20vikash 2984ca1
fix(cspell): Fix formatting
20vikash d8f2660
fix(database-server): Fix database server fields
20vikash b290e6a
fix(server): Add missing fields
20vikash e94d400
Merge branch 'develop' into press_agent
20vikash 4482173
fix(site): Fix ruff issues
20vikash 0a9e34e
fix(server): Fix semgrep rules
20vikash 95c099d
Merge branch 'develop' into press_agent
20vikash ed9e891
Merge branch 'develop' into press_agent
20vikash a3329e4
Merge branch 'develop' into press_agent
20vikash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import frappe | ||
|
|
||
| from press.agent import Agent | ||
|
|
||
|
|
||
| def verify_agent(server: str): | ||
| agent_token = frappe.request.headers.get("X-Agent-Token") | ||
|
|
||
| if not agent_token: | ||
| frappe.throw_permission_error() | ||
|
|
||
| agent = Agent(server) | ||
| agent.extract_and_verify_token(agent_token) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| - name: Write agent token | ||
| copy: | ||
| content: "{{ agent_token }}" | ||
| dest: "/home/frappe/agent/agent.token" | ||
| mode: '0600' | ||
|
tanmoysrt marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,5 +9,6 @@ | |
| - role: user | ||
| - role: nginx | ||
| - role: agent | ||
| - role: setup_agent_auth | ||
| - role: proxy | ||
| - role: docker | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| - name: Setup agent auth | ||
| hosts: all | ||
| become: yes | ||
| become_user: frappe | ||
| gather_facts: no | ||
| roles: | ||
| - role: setup_agent_auth |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Copyright (c) 2026, Frappe and contributors | ||
| // For license information, please see license.txt | ||
|
|
||
| // frappe.ui.form.on("Agent Auth", { | ||
| // refresh(frm) { | ||
|
|
||
| // }, | ||
| // }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.