-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/ai code reviewer #80
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
Changes from all commits
1e0575b
5905356
f1b954b
c3ad530
35ec7c5
0b857d5
5b60c23
e00f76e
e800281
9a407e5
f6c4a97
8786651
20ab9f4
9364348
a6268f5
2925d70
381467d
5fa5633
6ecf049
3116958
a198b6b
068fffe
5913257
f589e00
ae29b3b
4fff5fb
d8121f4
e00d21c
270b795
e0b3681
78e882e
0d3c59c
dc3b077
bb98ea3
e4e0855
2f3dec7
ae6ebe8
65baa16
2f87bd7
e60345c
ebed9c1
159a3a5
288fa63
147c6fd
66af149
d29526a
c3acbd3
b899c67
de6ba86
a5fc437
a69922e
00dd7f1
8363805
9004b79
9f9cf5d
9d59de7
8a5ae62
8dcbd4e
ed4f8fd
aa542bc
a8ef223
4647d12
2816e0e
c00e371
5c45620
8674de0
e27c69f
173e539
23b1011
4c406a0
a2678d7
c3d05c4
5f99cf3
d60ea80
a198c73
9989f4b
61d6e0c
1c8622f
6c3be43
5603996
32a023f
36377f7
962fa93
855904e
c68bdde
ec58f49
5309f84
31ca9ff
ea46cef
6d09753
10229ec
c68c525
eb43872
e541e04
9693b6f
61297cb
8aac430
56a9aff
84bfa47
3e37e83
5688a8b
5c6ee97
9852399
e25f497
c8223ec
8ccc4ba
15788e8
3b3ab75
413aaa1
d35e62d
67c4584
f9aba21
8fd7f76
795e3da
f90bdd2
67283e9
627260e
76746f9
45e0597
ba5ff9f
ce0ba87
641fef4
9c385ab
eddb415
ea811be
1938743
4fae0b9
d0e310a
0a09d9d
ccc338f
70ffd48
1435dfa
9219247
0257552
f1c211c
3e11115
3237dfc
eb28d38
ceffb76
6f4e9a5
cf018e0
b1978ff
277fe7b
6254919
1ee901b
614424d
980ced7
beefd59
7a02095
5b610e9
fbeaab1
613ec71
43eef80
11391af
f0bd058
f9cd0b9
1cab620
26a6b5e
962ac21
102caba
0d9ceff
960d787
4ee9c76
2731810
daf6ef3
47d1c07
7251c1a
133e642
0bc9fa0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,13 +68,19 @@ services: | |
| redis: | ||
| condition: service_healthy | ||
| networks: | ||
| - och | ||
| - opencodehub-internal | ||
| - opencodehub-external | ||
| healthcheck: | ||
| test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4321/api/health"] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 3 | ||
| start_period: 20s | ||
| deploy: | ||
| resources: | ||
| limits: | ||
| memory: 2G | ||
| cpus: "2.0" | ||
|
|
||
| # ── SSH Git server ───────────────────────────────────────── | ||
| ssh-git: | ||
|
|
@@ -108,7 +114,19 @@ services: | |
| redis: | ||
| condition: service_healthy | ||
| networks: | ||
| - och | ||
| - opencodehub-internal | ||
| - opencodehub-external | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "nc -z localhost 2222 || exit 1"] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 3 | ||
| start_period: 15s | ||
|
Comment on lines
+120
to
+124
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. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,260p' Dockerfile
rg -n -C 3 'netcat|nc[[:space:]]|openssh|2222|GIT_SSH_PORT' Dockerfile src scriptsRepository: swadhinbiswas/OpencodeHub Length of output: 50382 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- Docker-related files ---'
git ls-files | grep -E '(^|/)(Dockerfile|docker-compose[^/]*\.ya?ml|.*ssh.*|.*entrypoint.*|.*start.*)$' | head -200
printf '%s\n' '--- Compose lines 1-150 ---'
sed -n '1,150p' docker-compose.yml
printf '%s\n' '--- Dockerfile candidates and sizes ---'
for f in $(git ls-files | grep -E '(^|/)Dockerfile([^/]*)?$' | head -50); do
printf '%s\n' "--- $f ---"
wc -l "$f"
done
printf '%s\n' '--- Narrow SSH and netcat references ---'
rg -n -C 5 --glob 'Dockerfile*' --glob '*.sh' --glob '*.yml' --glob '*.yaml' \
'(^|[^[:alnum:]_])(netcat|netcat-openbsd|net-tools|openssh-server|sshd|GIT_SSH_PORT|2222|nc[[:space:]])([^[:alnum:]_]|$)' .Repository: swadhinbiswas/OpencodeHub Length of output: 13587 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- Dockerfile ---'
cat -n Dockerfile
printf '%s\n' '--- docker-entrypoint.sh ---'
cat -n docker-entrypoint.sh
printf '%s\n' '--- scripts/ssh-server.ts ---'
cat -n scripts/ssh-server.ts
printf '%s\n' '--- Relevant structural references ---'
rg -n -C 4 --glob 'Dockerfile*' --glob '*.sh' --glob 'scripts/ssh-server.ts' \
'(apt-get|apk|yum|dnf|pacman|bun install|npm install|netcat|nc|listen|createServer|GIT_SSH_PORT|2222)' .Repository: swadhinbiswas/OpencodeHub Length of output: 34281 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- SSH library outline/references ---'
rg -n -C 8 'startSSHServer|createServer|listen\(|hostKeyPath|ssh2|port:' src scripts package.json bun.lock
printf '%s\n' '--- SSH library implementation ---'
rg -l 'startSSHServer' src scripts | while IFS= read -r f; do
printf '%s\n' "--- $f ---"
cat -n "$f"
done
printf '%s\n' '--- Compose dependency timing fields ---'
rg -n -C 5 'depends_on|service_healthy|start_period|healthcheck|interval|timeout|retries' docker-compose.ymlRepository: swadhinbiswas/OpencodeHub Length of output: 50382 Install
🤖 Prompt for AI Agents |
||
| deploy: | ||
| resources: | ||
| limits: | ||
| memory: 512M | ||
| cpus: "1.0" | ||
|
|
||
| # ── Background worker (merge queue, webhooks, mirrors, digests) ── | ||
| worker: | ||
|
|
@@ -143,13 +161,18 @@ services: | |
| redis: | ||
| condition: service_healthy | ||
| networks: | ||
| - och | ||
| - opencodehub-internal | ||
| healthcheck: | ||
| test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/healthz"] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 3 | ||
| start_period: 20s | ||
| deploy: | ||
| resources: | ||
| limits: | ||
| memory: 1G | ||
| cpus: "1.0" | ||
|
|
||
| # ── PostgreSQL ───────────────────────────────────────────── | ||
| postgres: | ||
|
|
@@ -163,12 +186,17 @@ services: | |
| volumes: | ||
| - postgres-data:/var/lib/postgresql/data | ||
| networks: | ||
| - och | ||
| - opencodehub-internal | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-opencodehub} -d ${POSTGRES_DB:-opencodehub}"] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 5 | ||
| deploy: | ||
| resources: | ||
| limits: | ||
| memory: 1G | ||
| cpus: "1.0" | ||
|
|
||
| # ── Redis (sessions, caching, distributed locking, queues) ── | ||
| redis: | ||
|
|
@@ -188,12 +216,17 @@ services: | |
| volumes: | ||
| - redis-data:/data | ||
| networks: | ||
| - och | ||
| - opencodehub-internal | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 5 | ||
| deploy: | ||
| resources: | ||
| limits: | ||
| memory: 512M | ||
| cpus: "0.5" | ||
|
|
||
| # ── CI/CD Runner (Docker-in-Docker, optional) ────────────── | ||
| runner: | ||
|
|
@@ -216,7 +249,18 @@ services: | |
| depends_on: | ||
| - app | ||
| networks: | ||
| - och | ||
| - opencodehub-external | ||
| healthcheck: | ||
| test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/healthz"] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 3 | ||
| start_period: 20s | ||
|
Comment on lines
+253
to
+258
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. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,300p' Dockerfile.runner
rg -n -C 3 '9090|healthz|RUNNER_HEALTH_PORT|wget' Dockerfile.runner src scriptsRepository: swadhinbiswas/OpencodeHub Length of output: 4013 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- runner service ---'
sed -n '225,270p' docker-compose.yml
printf '%s\n' '--- runner script ---'
wc -l scripts/runner.sh
cat -n scripts/runner.sh
printf '%s\n' '--- runner-related definitions and references ---'
rg -n -C 4 'runner|RUNNER_HEALTH_PORT|9090|healthz|wget|curl' docker-compose.yml Dockerfile.runner scriptsRepository: swadhinbiswas/OpencodeHub Length of output: 32889 🌐 Web query:
💡 Result: The official Citations:
Expose a runner health endpoint or remove this health check.
🤖 Prompt for AI Agents |
||
| deploy: | ||
| resources: | ||
| limits: | ||
| memory: 2G | ||
| cpus: "2.0" | ||
| profiles: | ||
| - with-runner | ||
|
|
||
|
|
@@ -234,7 +278,7 @@ services: | |
| volumes: | ||
| - minio-data:/data | ||
| networks: | ||
| - och | ||
| - opencodehub-external | ||
| healthcheck: | ||
| test: ["CMD", "mc", "ready", "local"] | ||
| interval: 30s | ||
|
|
@@ -264,5 +308,7 @@ volumes: | |
| driver: local | ||
|
|
||
| networks: | ||
| och: | ||
| opencodehub-internal: | ||
| driver: bridge | ||
| opencodehub-external: | ||
| driver: bridge | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ let db: | |
| | LibSQLDatabase<typeof schema> | ||
| | NodePgDatabase<typeof schema> | ||
| | null = null; | ||
| let pgPool: pg.Pool | null = null; | ||
|
|
||
| /** | ||
| * Infer database driver from connection URL when no explicit driver is set. | ||
|
|
@@ -113,6 +114,10 @@ export function getDatabase(): | |
| ssl: sslEnabled ? { rejectUnauthorized } : undefined, | ||
| max: parseInt(process.env.DATABASE_POOL_SIZE || "10", 10), | ||
| }); | ||
| pool.on('error', (err) => { | ||
| logger.error({ err }, 'Unexpected database pool error'); | ||
| }); | ||
| pgPool = pool; | ||
|
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. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Close the previous PostgreSQL pool during database reset.
Make reset asynchronous and end 🤖 Prompt for AI Agents |
||
| db = drizzlePg(pool, { schema }); | ||
| logger.info( | ||
| { | ||
|
|
@@ -179,9 +184,11 @@ export async function closeDatabase(): Promise<void> { | |
| // @ts-ignore | ||
| db.close(); | ||
| } | ||
| // For PG pool, we might need to close the pool if we had access to it, | ||
| // but Drizzle doesn't expose it directly on the db instance easily without type casting. | ||
| // In serverless/long-running app, closing might not be strictly necessary unless ensuring graceful shutdown. | ||
| // Close PostgreSQL pool if available | ||
| if (pgPool) { | ||
| await pgPool.end(); | ||
| pgPool = null; | ||
| } | ||
|
|
||
| logger.info("Database connection closed"); | ||
| db = null; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { relations } from "drizzle-orm"; | ||
| import { boolean, integer, pgTable, text, timestamp } from "drizzle-orm/pg-core"; | ||
| import { boolean, index, integer, pgTable, text, timestamp } from "drizzle-orm/pg-core"; | ||
| import { pullRequests } from "./pull-requests"; | ||
| import { repositories } from "./repositories"; | ||
| import { users } from "./users"; | ||
|
|
@@ -38,7 +38,13 @@ export const mergeQueue = pgTable("merge_queue", { | |
| startedAt: timestamp("started_at"), | ||
| completedAt: timestamp("completed_at"), | ||
| failureReason: text("failure_reason"), | ||
| }); | ||
| }, | ||
| (t) => ({ | ||
| repoIdx: index("merge_queue_repo_idx").on(t.repositoryId), | ||
| statusIdx: index("merge_queue_status_idx").on(t.status), | ||
| prIdx: index("merge_queue_pr_idx").on(t.pullRequestId), | ||
| }), | ||
|
Comment on lines
+42
to
+46
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. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Add committed migrations for all newly declared indexes. Schema declarations alone do not update deployed databases. Add and apply migration statements for the three 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| ); | ||
|
|
||
| // Alias for backwards compatibility | ||
| export const mergeQueueItems = mergeQueue; | ||
|
|
||
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: swadhinbiswas/OpencodeHub
Length of output: 4992
🏁 Script executed:
Repository: swadhinbiswas/OpencodeHub
Length of output: 11108
🏁 Script executed:
Repository: swadhinbiswas/OpencodeHub
Length of output: 27429
🏁 Script executed:
Repository: swadhinbiswas/OpencodeHub
Length of output: 12710
Enforce secret separation at startup.
The production entrypoint does not invoke
validateEnvironment(). Add this validation to startup and reject production whenSESSION_SECRET === JWT_SECRET.🤖 Prompt for AI Agents