-
Notifications
You must be signed in to change notification settings - Fork 6
Clean rebase agent rewrite onto master #209
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
base: master
Are you sure you want to change the base?
Changes from all commits
80f404c
8554298
8dfba17
2f79d4b
7358319
0f41c62
b0e4fe8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -325,6 +325,12 @@ log "Added Google OAuth domains to /etc/hosts" | |||||||||||||||||||||||||||||
| echo "127.0.0.15 appleid.apple.com" >> /etc/hosts | ||||||||||||||||||||||||||||||
| log "Added Apple OAuth domain to /etc/hosts" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Add push provider hostnames to /etc/hosts | ||||||||||||||||||||||||||||||
| echo "127.0.0.21 api.push.apple.com" >> /etc/hosts | ||||||||||||||||||||||||||||||
| echo "127.0.0.22 api.sandbox.push.apple.com" >> /etc/hosts | ||||||||||||||||||||||||||||||
| echo "127.0.0.20 fcm.googleapis.com" >> /etc/hosts | ||||||||||||||||||||||||||||||
|
Comment on lines
+328
to
+331
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Make the These unconditional appends accumulate duplicate entries across restarts, and a stale earlier mapping can win because host resolution stops at the first matching line. Later updates to these loopback IPs may never take effect. One way to upsert the mappings-echo "127.0.0.21 api.push.apple.com" >> /etc/hosts
-echo "127.0.0.22 api.sandbox.push.apple.com" >> /etc/hosts
-echo "127.0.0.20 fcm.googleapis.com" >> /etc/hosts
+for host in api.push.apple.com api.sandbox.push.apple.com fcm.googleapis.com; do
+ sed -i "/[[:space:]]${host//./\\.}\$/d" /etc/hosts
+done
+cat >> /etc/hosts <<'EOF'
+127.0.0.21 api.push.apple.com
+127.0.0.22 api.sandbox.push.apple.com
+127.0.0.20 fcm.googleapis.com
+EOF
log "Added APNs and FCM domains to /etc/hosts"📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck (0.11.0)[style] 329-329: Consider using { cmd1; cmd2; } >> file instead of individual redirects. (SC2129) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| log "Added APNs and FCM domains to /etc/hosts" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Add AWS SQS hostname to /etc/hosts | ||||||||||||||||||||||||||||||
| echo "127.0.0.13 sqs.us-east-2.amazonaws.com" >> /etc/hosts | ||||||||||||||||||||||||||||||
| log "Added AWS SQS domain to /etc/hosts" | ||||||||||||||||||||||||||||||
|
|
@@ -459,6 +465,16 @@ run_forever tf_os_flags python3 /app/traffic_forwarder.py 127.0.0.18 443 3 8028 | |||||||||||||||||||||||||||||
| log "Starting Apple OAuth traffic forwarder" | ||||||||||||||||||||||||||||||
| run_forever tf_apple_oauth python3 /app/traffic_forwarder.py 127.0.0.15 443 3 8018 & | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Start the traffic forwarders for push providers in the background | ||||||||||||||||||||||||||||||
| log "Starting APNs production traffic forwarder" | ||||||||||||||||||||||||||||||
| run_forever tf_apns_prod python3 /app/traffic_forwarder.py 127.0.0.21 443 3 8024 & | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| log "Starting APNs sandbox traffic forwarder" | ||||||||||||||||||||||||||||||
| run_forever tf_apns_sandbox python3 /app/traffic_forwarder.py 127.0.0.22 443 3 8025 & | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| log "Starting FCM traffic forwarder" | ||||||||||||||||||||||||||||||
| run_forever tf_fcm python3 /app/traffic_forwarder.py 127.0.0.20 443 3 8029 & | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Start the traffic forwarders for Tinfoil proxy in the background | ||||||||||||||||||||||||||||||
| log "Starting Tinfoil GitHub proxy traffic forwarder" | ||||||||||||||||||||||||||||||
| run_forever tf_tinfoil_github_proxy python3 /app/traffic_forwarder.py 127.0.0.16 443 3 8019 & | ||||||||||||||||||||||||||||||
|
|
@@ -657,6 +673,28 @@ else | |||||||||||||||||||||||||||||
| log "Apple OAuth connection failed" | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Test the connections to push providers | ||||||||||||||||||||||||||||||
| log "Testing connection to APNs production:" | ||||||||||||||||||||||||||||||
| if timeout 5 bash -c '</dev/tcp/127.0.0.21/443'; then | ||||||||||||||||||||||||||||||
| log "APNs production connection successful" | ||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||
| log "APNs production connection failed" | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| log "Testing connection to APNs sandbox:" | ||||||||||||||||||||||||||||||
| if timeout 5 bash -c '</dev/tcp/127.0.0.22/443'; then | ||||||||||||||||||||||||||||||
| log "APNs sandbox connection successful" | ||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||
| log "APNs sandbox connection failed" | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| log "Testing connection to FCM:" | ||||||||||||||||||||||||||||||
| if timeout 5 bash -c '</dev/tcp/127.0.0.20/443'; then | ||||||||||||||||||||||||||||||
| log "FCM connection successful" | ||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||
| log "FCM connection failed" | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Test the connections to Tinfoil proxy services | ||||||||||||||||||||||||||||||
| log "Testing connection to Tinfoil GitHub proxy:" | ||||||||||||||||||||||||||||||
| if timeout 5 bash -c '</dev/tcp/127.0.0.16/443'; then | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| DELETE FROM notification_deliveries; | ||
| DELETE FROM notification_events; | ||
| DELETE FROM agent_schedule_runs; | ||
| DELETE FROM agent_background_grants; | ||
| DELETE FROM agent_schedules; | ||
|
|
||
| DROP INDEX IF EXISTS idx_notification_events_background_grant; | ||
|
|
||
| ALTER TABLE notification_events | ||
| DROP COLUMN IF EXISTS background_grant_id; | ||
|
|
||
| ALTER TABLE notification_events | ||
| DROP CONSTRAINT IF EXISTS notification_events_source_kind_check; | ||
|
|
||
| ALTER TABLE notification_events | ||
| ADD CONSTRAINT notification_events_source_kind_check | ||
| CHECK (source_kind IN ('request_continuation')); | ||
|
|
||
| DROP TRIGGER IF EXISTS update_agent_background_grants_updated_at ON agent_background_grants; | ||
| DROP INDEX IF EXISTS idx_agent_background_grants_user; | ||
| DROP INDEX IF EXISTS idx_agent_background_grants_schedule_active; | ||
| DROP TABLE IF EXISTS agent_background_grants; | ||
|
|
||
| ALTER TABLE agent_schedules | ||
| ADD COLUMN description TEXT NOT NULL, | ||
| DROP COLUMN IF EXISTS description_enc; | ||
|
|
||
| ALTER TABLE user_seed_wrappings | ||
| DROP CONSTRAINT IF EXISTS user_seed_wrappings_credential_kind_check; | ||
|
|
||
| ALTER TABLE user_seed_wrappings | ||
| ADD CONSTRAINT user_seed_wrappings_credential_kind_check | ||
| CHECK (credential_kind IN ('password', 'oauth')); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| DELETE FROM agent_schedule_runs; | ||
| DELETE FROM agent_schedules; | ||
|
|
||
| ALTER TABLE user_seed_wrappings | ||
| DROP CONSTRAINT IF EXISTS user_seed_wrappings_credential_kind_check; | ||
|
|
||
| ALTER TABLE user_seed_wrappings | ||
| ADD CONSTRAINT user_seed_wrappings_credential_kind_check | ||
| CHECK (credential_kind IN ('password', 'oauth', 'agent_background')); | ||
|
|
||
| ALTER TABLE agent_schedules | ||
| ADD COLUMN description_enc BYTEA NOT NULL, | ||
| DROP COLUMN description; | ||
|
|
||
| CREATE TABLE agent_background_grants ( | ||
| id BIGSERIAL PRIMARY KEY, | ||
| uuid UUID NOT NULL DEFAULT gen_random_uuid() UNIQUE, | ||
| user_id UUID NOT NULL REFERENCES users(uuid) ON DELETE CASCADE, | ||
| project_id INTEGER NOT NULL REFERENCES org_projects(id) ON DELETE CASCADE, | ||
| agent_id BIGINT NOT NULL REFERENCES agents(id) ON DELETE CASCADE, | ||
| schedule_id BIGINT NOT NULL REFERENCES agent_schedules(id) ON DELETE CASCADE, | ||
| grant_enc BYTEA NOT NULL, | ||
| seed_wrap_lookup_hash BYTEA NOT NULL, | ||
| revoked_at TIMESTAMP WITH TIME ZONE, | ||
| created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
| ); | ||
|
|
||
| CREATE UNIQUE INDEX idx_agent_background_grants_schedule_active | ||
| ON agent_background_grants(schedule_id) | ||
| WHERE revoked_at IS NULL; | ||
|
|
||
| CREATE INDEX idx_agent_background_grants_user | ||
| ON agent_background_grants(user_id, revoked_at); | ||
|
|
||
| CREATE TRIGGER update_agent_background_grants_updated_at | ||
| BEFORE UPDATE ON agent_background_grants | ||
| FOR EACH ROW | ||
| EXECUTE FUNCTION update_updated_at_column(); | ||
|
|
||
| ALTER TABLE notification_events | ||
| DROP CONSTRAINT IF EXISTS notification_events_source_kind_check; | ||
|
|
||
| ALTER TABLE notification_events | ||
| ADD CONSTRAINT notification_events_source_kind_check | ||
| CHECK (source_kind IN ('request_continuation', 'agent_background')); | ||
|
|
||
| ALTER TABLE notification_events | ||
| ADD COLUMN background_grant_id BIGINT REFERENCES agent_background_grants(id) ON DELETE SET NULL; | ||
|
|
||
| CREATE INDEX idx_notification_events_background_grant | ||
| ON notification_events(background_grant_id) | ||
| WHERE background_grant_id IS NOT NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the markdownlint violations in this new section.
The added fences are missing language tags, and Line 605 jumps from
##to####, so this section will keep tripping MD040/MD001. Please tag the blocks (bash,yaml,ini) and make the provider headings###.🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 594-594: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 599-599: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 605-605: Heading levels should only increment by one level at a time
Expected: h3; Actual: h4
(MD001, heading-increment)
[warning] 608-608: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 612-612: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 627-627: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 631-631: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 646-646: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 650-650: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 666-666: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 680-680: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Source: Linters/SAST tools