feat: convert to thin proxy (scrape → router, prompts → connect) - #49
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR removes local fan-out and in-process scrape execution, routes job lifecycle operations through a router-first path with DB fallback, adds ChittyConnect prompt APIs, and updates cron/routes to pass the Cloudflare env and use ChittyConnect-first AI flows with gateway fallback. (50 words) Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant JobDispatcher
participant Router
participant Database
Client->>JobDispatcher: enqueueJob(jobType, target, env)
alt Router available & returns id
JobDispatcher->>Router: POST /agents/scrape/enqueue
Router-->>JobDispatcher: { id, ... }
JobDispatcher-->>Client: { jobId: id }
else Router missing/fails
JobDispatcher->>Database: INSERT INTO cc_scrape_jobs (...)
Database-->>JobDispatcher: { insertedJobId }
JobDispatcher-->>Client: { jobId: insertedJobId }
end
sequenceDiagram
participant Client
participant Route
participant ChittyConnect
participant AIGateway
Client->>Route: POST /synthesize (payload)
Route->>ChittyConnect: POST /api/v1/context/prompts/execute
alt ChittyConnect responds
ChittyConnect-->>Route: { result, aiEnabled }
alt aiEnabled true
Route-->>Client: { synthesis: result }
else aiEnabled false
Route-->>Client: { synthesis: rawNotes }
end
else ChittyConnect unavailable/fails
Route->>AIGateway: callAIGatewayFallback(systemPrompt, userPrompt)
AIGateway-->>Route: text response
Route-->>Client: { synthesis: parsed response }
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd8ec4d728
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/job-dispatcher.ts (1)
71-86:⚠️ Potential issue | 🟠 MajorThe Neon fallback queue is a dead end right now.
These lines still write fallback jobs into
cc_scrape_jobs, butprocessQueue()no longer drains that table or delegates to any local executor. Insrc/lib/cron.ts, the utility, court, and monthly flows enqueue and then immediately call this function, so a router outage now accepts work into the legacy queue and silently leaves it there.Also applies to: 93-105
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/job-dispatcher.ts` around lines 71 - 86, The current fallback in job-dispatcher.ts writes into cc_scrape_jobs (INSERT block using scheduledAt and JSON target) but processQueue() no longer drains that table, causing jobs to be dropped; update the fallback to not silently persist to cc_scrape_jobs: either (1) detect router/unavailable condition and throw an error so callers in src/lib/cron.ts see failure, or (2) replace the INSERT with a call to the new router/enqueue function used by the main path (e.g., enqueueToRouter or whatever the project uses) so jobs go to the active queue; make the change in the job-dispatcher fallback branch (the INSERT/RETURNING id block) and ensure callers (cron flows) receive the propagated error or the router-enqueued result instead of a silent local DB insert.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/job-dispatcher.ts`:
- Around line 142-149: The router-backed code path (routerClient ->
router.listScrapeJobs) is dropping caller filters like chittyId and offset (and
getDeadLetters is dropping limit), so requests routed through router return
incorrect pages or results; update the call to router.listScrapeJobs (and any
router-backed listJobs/getDeadLetters usages) to forward all incoming filter
fields (status, jobType, limit, chittyId, offset, etc.), or conditionally bypass
the router path when those fields aren't supported by the router, ensuring the
routerClient/router.listScrapeJobs and getDeadLetters call sites preserve the
full requested shape.
- Around line 58-68: The current logic calls router.enqueueScrapeJob() and—on
any non-successful response—unconditionally enqueues a local job, risking
duplicate non-idempotent writes; fix by generating a single shared job id (e.g.,
create a jobId/uuid if not provided via opts) before any network call, pass that
id into router.enqueueScrapeJob(...) and into the local enqueue path so both
systems use the same idempotency key, and only fall back to local enqueue when
routerClient(env) is null/undefined or when the POST has definitively failed
with a server-side error that confirms no job was created (not on ambiguous
network timeouts); update code references routerClient, router.enqueueScrapeJob,
and the local enqueue call to accept and propagate this shared jobId.
In `@src/routes/litigation.ts`:
- Around line 28-32: Move the Zod schemas synthesizeSchema, draftSchema, and
qcSchema out of the route file into the centralized validators module and export
them, then remove the inline c.req.json().catch(...)+safeParse(...) validation
blocks in the litigationRoutes.post handlers for '/synthesize', '/draft', and
'/qc' and instead attach the zValidator('json', <schema>) middleware to each
route; finally, inside each handler replace usage of the parsed request with the
validated payload obtained via c.req.valid('json'). Ensure you reference the
exact schema names (synthesizeSchema, draftSchema, qcSchema), the middleware
function zValidator, and extract data using c.req.valid('json') in the handler
bodies.
---
Outside diff comments:
In `@src/lib/job-dispatcher.ts`:
- Around line 71-86: The current fallback in job-dispatcher.ts writes into
cc_scrape_jobs (INSERT block using scheduledAt and JSON target) but
processQueue() no longer drains that table, causing jobs to be dropped; update
the fallback to not silently persist to cc_scrape_jobs: either (1) detect
router/unavailable condition and throw an error so callers in src/lib/cron.ts
see failure, or (2) replace the INSERT with a call to the new router/enqueue
function used by the main path (e.g., enqueueToRouter or whatever the project
uses) so jobs go to the active queue; make the change in the job-dispatcher
fallback branch (the INSERT/RETURNING id block) and ensure callers (cron flows)
receive the propagated error or the router-enqueued result instead of a silent
local DB insert.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5c68a9d2-afac-46cf-9ffe-e58e34d77364
📒 Files selected for processing (7)
src/lib/cron.tssrc/lib/fan-out.tssrc/lib/integrations.tssrc/lib/job-dispatcher.tssrc/routes/jobs.tssrc/routes/litigation.tssrc/routes/mcp.ts
💤 Files with no reviewable changes (1)
- src/lib/fan-out.ts
…sumer Scope violation fix: ChittyCommand (Tier 5 dashboard) was acting as orchestrator — owning job queues, execution, retry/backoff, and calling ChittyRouter agents via HTTP fan-out. This moves orchestration to where it belongs (ChittyRouter ScrapeAgent DO) and makes ChittyCommand a thin proxy. Changes: - DELETE fan-out.ts: orchestration now handled by ScrapeAgent DO-to-DO calls - REWRITE job-dispatcher.ts: proxy to ChittyRouter /agents/scrape/* with Neon fallback - ADD to integrations.ts: ScrapeAgent proxy methods (routerClient) + prompt registry methods (connectClient.resolvePrompt, executePrompt) - UPDATE litigation.ts: resolve prompts from ChittyConnect with AI Gateway fallback - UPDATE jobs.ts, mcp.ts, cron.ts: pass env for router proxy delegation Net result: -231 lines, ChittyCommand no longer owns scrape orchestration or hardcoded AI prompts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dd8ec4d to
cd73f4e
Compare
|
|
To use Codex here, create a Codex account and connect to github. |
🧩 Analysis chain🏁 Script executed: Length of output: 131257
🔴 Critical1. Router auth silently degrades to unauthenticated (
|
| # | Severity | Area | Issue |
|---|---|---|---|
| 1 | 🔴 Critical | integrations.ts |
Router auth silently degrades to unauthenticated |
| 2 | 🔴 Critical | litigation.ts |
AI model name sourced from mutable KV |
| 3 | 🔴 Critical | fan-out.ts (deleted) |
ChittyLedger audit trail removed, replacement unverified |
| 4 | 🟠 High | integrations.ts |
ConnectClient auth is optional with no warning |
| 5 | 🟠 High | job-dispatcher.ts |
mapRouterJob blindly casts unvalidated router data |
| 6 | 🟠 High | mcp.ts |
connect_discover KV cache poisoning |
| 7 | 🟡 Medium | job-dispatcher.ts |
Unconditional Neon fallback bypasses router controls |
| 8 | 🟡 Medium | litigation.ts |
Prompt injection surface in user content |
| 9 | 🟡 Medium | jobs.ts |
processQueue limit param silently dropped |
| 10 | 🟢 Low | cron.ts |
Hardcoded court case number |
| 11 | 🟢 Low | job-dispatcher.ts |
Phantom retry records for router-managed jobs |
| 12 | 🟢 Info | CI | No CI artifact; "verified locally" only |
Items 1, 2, and 3 are merge blockers per repository policy (security, correctness, compliance). Items 4–6 should be resolved before merge or tracked as immediate follow-ups.
🧠 Learnings used
Learnt from: CR
Repo: chittyos/chittycommand PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-03-04T04:42:57.380Z
Learning: Resolve must-fix review comments (security, correctness, compliance, merge blockers) before merge
Learnt from: CR
Repo: chittyos/chittycommand PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-09T16:02:20.597Z
Learning: Applies to src/routes/connect.ts : Implement ChittyConnect discovery proxy with rate limiting in `src/routes/connect.ts`
✅ Actions performed
Review triggered.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/lib/integrations.ts (1)
617-628:⚠️ Potential issue | 🔴 CriticalFail closed when
scrape:service_tokenis absent.These new ScrapeAgent proxy methods inherit
authHeaders(), which currently only warns and still sends the request withoutAuthorization. Missing router auth should stop the proxy call outright, otherwise a KV/config drift turns into silent unauthenticated access or a confusing fallback path.Also applies to: 696-729
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/integrations.ts` around lines 617 - 628, The authHeaders() helper currently only warns when env.COMMAND_KV lacks 'scrape:service_token' and returns unauthenticated headers; change it to fail-closed by throwing an error (or returning a rejected Promise) when token is absent so callers cannot proceed; update authHeaders() (and any other uses inherited by ScrapeAgent proxy methods) to log the missing-token error and throw (e.g., new Error('missing scrape:service_token')) instead of returning headers without Authorization, ensuring proxy calls abort immediately on missing router auth.src/routes/litigation.ts (1)
172-173:⚠️ Potential issue | 🔴 CriticalDon't source the litigation model from writable KV.
chat:modelcan be changed at runtime without a deploy or code review, so a KV write can silently swap the model used for legal drafting and QC. Keep the model in env/secret-controlled config, or allowlist the KV value before using it.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/routes/litigation.ts` around lines 172 - 173, The current code reads the litigation model from writable KV via env.COMMAND_KV.get('chat:model') into chatModel which allows runtime tampering; change this to use a secret/env-controlled config (e.g., process env like ENV_CHAT_MODEL or env.CHAT_MODEL) or, if KV must be supported, validate the returned value against a strict allowlist of permitted model names before using it (e.g., compare to allowed values such as 'dynamic/chittycommand' or other whitelisted names). Modify the code that references env.COMMAND_KV.get('chat:model') and the variable chatModel to either read from the immutable env secret or to perform allowlist validation and fall back to the safe default 'dynamic/chittycommand' when the value is missing/invalid.src/lib/job-dispatcher.ts (1)
71-85:⚠️ Potential issue | 🔴 CriticalThe Neon fallback queue is now orphaned.
This file still inserts/requeues
cc_scrape_jobs, but the local executor is gone andprocessQueue()now returns zeros whenever Router processing is unavailable. During a router outage, callers get a job ID ortruefor work that will never run.Also applies to: 99-105, 223-238
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/job-dispatcher.ts` around lines 71 - 85, The current fallback that inserts into cc_scrape_jobs (the SQL INSERT block using scheduledAt / JSON target) must be removed because the local Neon executor is gone; instead detect Router availability and fail fast so callers don't receive a fake job id/true. Remove or disable the INSERT INTO cc_scrape_jobs code path in src/lib/job-dispatcher.ts (the SQL INSERT that returns id) and all other requeue paths that write to cc_scrape_jobs (referenced around the other ranges noted), and update the surrounding job dispatch functions (the callers of processQueue() / the code that returns a job id or true) to return an explicit error/false or throw when Router is unavailable. Ensure logs clearly indicate Router-unavailable and no cc_scrape_jobs writes remain.
♻️ Duplicate comments (3)
src/lib/integrations.ts (1)
698-725:⚠️ Potential issue | 🟠 MajorThe scrape proxy API surface is narrower than the existing dispatcher contract.
enqueueScrapeJob()dropsscheduledAtandparentJobId,listScrapeJobs()dropschittyIdandoffset, and both dead-letter/process helpers droplimit. Once callers go through this client, those behaviors disappear unless you explicitly bypass Router for unsupported fields.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/integrations.ts` around lines 698 - 725, The client API narrows the dispatcher contract by omitting fields: update enqueueScrapeJob to accept and forward scheduledAt and parentJobId (extend opts for enqueueScrapeJob and include them in the POST body), update listScrapeJobs to accept chittyId and offset (add them to the filters and include in the URLSearchParams), and update getScrapeDeadLetters and processScrapeQueue to accept and forward limit (add an optional limit param and include it in the query string or POST body as the server expects). Modify the signatures for enqueueScrapeJob, listScrapeJobs, getScrapeDeadLetters, and processScrapeQueue to include these optional fields and ensure they are serialized when calling post/get so callers retain the original dispatcher behavior.src/lib/job-dispatcher.ts (1)
57-68:⚠️ Potential issue | 🔴 CriticalDon't enqueue locally after an ambiguous router write failure.
Once
router.enqueueScrapeJob()has been attempted,nulldoes not prove Router failed to create the job. Falling back to Neon here can enqueue a second copy of the same non-idempotent scrape.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/job-dispatcher.ts` around lines 57 - 68, The code currently falls back to the local Neon queue even when router.enqueueScrapeJob() returns an ambiguous result (null/undefined), which risks enqueuing duplicate non-idempotent work; change the logic around routerClient(env)/router.enqueueScrapeJob so that you only use the local fallback when the router client is not available or when enqueueScrapeJob throws an error (network/transport failure). Specifically, wrap the call to router.enqueueScrapeJob in a try/catch, return the id if result?.id exists, and if the call completes but returns no id do NOT call the local enqueue path — instead propagate an error or undefined to the caller so the duplicate enqueue cannot happen; keep routerClient, enqueueScrapeJob, and the local fallback code paths intact but gated as described.src/routes/litigation.ts (1)
9-24: 🛠️ Refactor suggestion | 🟠 MajorMove these schemas into
src/lib/validators.tsand usezValidator('json', ...).These handlers still define local Zod schemas and parse
c.req.json()manually, so the route bypasses the shared validator module and middleware pattern. Please move the schemas tosrc/lib/validators.ts, attachzValidator('json', schema)on each route, and read the payload fromc.req.valid('json'). As per coding guidelines, "Use Zod for request validation viasrc/lib/validators.ts", "Define all Zod schemas insrc/lib/validators.ts", and "Use@hono/zod-validatorwithzValidator('json', schema)for request body validation".Also applies to: 28-33, 72-76, 113-117
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/routes/litigation.ts` around lines 9 - 24, Move the three Zod schemas (synthesizeSchema, draftSchema, qcSchema) out of the route and export them from the shared validators module; then attach each route handler to the validator middleware using zValidator('json', <appropriateSchema>) and replace manual c.req.json() parsing with c.req.valid('json') to read the validated payload. Specifically, define and export synthesizeSchema, draftSchema, and qcSchema in the shared validators module, update the route definitions to include zValidator('json', synthesizeSchema|draftSchema|qcSchema) as middleware, and within the handlers read the request body via c.req.valid('json') instead of manual JSON parsing. Ensure the schemas retain their original constraints (rawNotes, property, caseNumber; synthesizedFacts, focus, recipient; rawNotes, draftEmail).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/integrations.ts`:
- Around line 315-323: connectPost currently silently omits the Authorization
header when env.CHITTY_CONNECT_TOKEN is not set; change connectPost to fail
closed by checking env.CHITTY_CONNECT_TOKEN at the start of the function (inside
connectPost) and throw a clear error (or return a rejected Promise) if the token
is missing so no unauthenticated requests are sent to ChittyConnect; preserve
the existing header-building logic (headers['Authorization'] = `Bearer
${env.CHITTY_CONNECT_TOKEN}`) but only after the presence check, and ensure
callers of connectPost (e.g., routes that call connectPost) will surface the
thrown error instead of falling back to direct AI paths.
In `@src/lib/job-dispatcher.ts`:
- Around line 243-260: The mapRouterJob function is overwriting and inventing
fields from the Router payload; update mapRouterJob to copy values directly from
the ScrapeJobResponse instead of forcing defaults: assign scheduledAt =
r.scheduledAt (not r.createdAt), and preserve r.chittyId, r.startedAt,
r.parentJobId, r.cronSource rather than forcing nulls; for optional fields use
null-coalescing (e.g. completedAt = r.completedAt ?? null, result = r.result ??
null, errorMessage = r.error ?? null) and remove blind type assertions like
r.jobType as ScrapeJobType / r.status as ScrapeJobStatus — either keep
r.jobType/r.status as-is or add a runtime/type-guard validation before casting
so Router-backed reads reflect the upstream payload accurately.
In `@src/routes/litigation.ts`:
- Around line 134-138: The code only checks JSON syntax but not the expected
shape; after parsing cleaned (the value from result.result), validate that the
parsed object has the expected structure (e.g., an object with a property
"flags" that is an array) before returning it as flags; if validation fails,
return the same warning payload (or a 400) with flags: [] and a clear warning.
Apply the same shape validation to the other QC-parsing branch that uses the
same cleaning/parsing logic (the block handling result.result around lines
149-151) so both paths enforce that parsed.flags is an array before responding.
---
Outside diff comments:
In `@src/lib/integrations.ts`:
- Around line 617-628: The authHeaders() helper currently only warns when
env.COMMAND_KV lacks 'scrape:service_token' and returns unauthenticated headers;
change it to fail-closed by throwing an error (or returning a rejected Promise)
when token is absent so callers cannot proceed; update authHeaders() (and any
other uses inherited by ScrapeAgent proxy methods) to log the missing-token
error and throw (e.g., new Error('missing scrape:service_token')) instead of
returning headers without Authorization, ensuring proxy calls abort immediately
on missing router auth.
In `@src/lib/job-dispatcher.ts`:
- Around line 71-85: The current fallback that inserts into cc_scrape_jobs (the
SQL INSERT block using scheduledAt / JSON target) must be removed because the
local Neon executor is gone; instead detect Router availability and fail fast so
callers don't receive a fake job id/true. Remove or disable the INSERT INTO
cc_scrape_jobs code path in src/lib/job-dispatcher.ts (the SQL INSERT that
returns id) and all other requeue paths that write to cc_scrape_jobs (referenced
around the other ranges noted), and update the surrounding job dispatch
functions (the callers of processQueue() / the code that returns a job id or
true) to return an explicit error/false or throw when Router is unavailable.
Ensure logs clearly indicate Router-unavailable and no cc_scrape_jobs writes
remain.
In `@src/routes/litigation.ts`:
- Around line 172-173: The current code reads the litigation model from writable
KV via env.COMMAND_KV.get('chat:model') into chatModel which allows runtime
tampering; change this to use a secret/env-controlled config (e.g., process env
like ENV_CHAT_MODEL or env.CHAT_MODEL) or, if KV must be supported, validate the
returned value against a strict allowlist of permitted model names before using
it (e.g., compare to allowed values such as 'dynamic/chittycommand' or other
whitelisted names). Modify the code that references
env.COMMAND_KV.get('chat:model') and the variable chatModel to either read from
the immutable env secret or to perform allowlist validation and fall back to the
safe default 'dynamic/chittycommand' when the value is missing/invalid.
---
Duplicate comments:
In `@src/lib/integrations.ts`:
- Around line 698-725: The client API narrows the dispatcher contract by
omitting fields: update enqueueScrapeJob to accept and forward scheduledAt and
parentJobId (extend opts for enqueueScrapeJob and include them in the POST
body), update listScrapeJobs to accept chittyId and offset (add them to the
filters and include in the URLSearchParams), and update getScrapeDeadLetters and
processScrapeQueue to accept and forward limit (add an optional limit param and
include it in the query string or POST body as the server expects). Modify the
signatures for enqueueScrapeJob, listScrapeJobs, getScrapeDeadLetters, and
processScrapeQueue to include these optional fields and ensure they are
serialized when calling post/get so callers retain the original dispatcher
behavior.
In `@src/lib/job-dispatcher.ts`:
- Around line 57-68: The code currently falls back to the local Neon queue even
when router.enqueueScrapeJob() returns an ambiguous result (null/undefined),
which risks enqueuing duplicate non-idempotent work; change the logic around
routerClient(env)/router.enqueueScrapeJob so that you only use the local
fallback when the router client is not available or when enqueueScrapeJob throws
an error (network/transport failure). Specifically, wrap the call to
router.enqueueScrapeJob in a try/catch, return the id if result?.id exists, and
if the call completes but returns no id do NOT call the local enqueue path —
instead propagate an error or undefined to the caller so the duplicate enqueue
cannot happen; keep routerClient, enqueueScrapeJob, and the local fallback code
paths intact but gated as described.
In `@src/routes/litigation.ts`:
- Around line 9-24: Move the three Zod schemas (synthesizeSchema, draftSchema,
qcSchema) out of the route and export them from the shared validators module;
then attach each route handler to the validator middleware using
zValidator('json', <appropriateSchema>) and replace manual c.req.json() parsing
with c.req.valid('json') to read the validated payload. Specifically, define and
export synthesizeSchema, draftSchema, and qcSchema in the shared validators
module, update the route definitions to include zValidator('json',
synthesizeSchema|draftSchema|qcSchema) as middleware, and within the handlers
read the request body via c.req.valid('json') instead of manual JSON parsing.
Ensure the schemas retain their original constraints (rawNotes, property,
caseNumber; synthesizedFacts, focus, recipient; rawNotes, draftEmail).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5b32f7d7-3095-4607-8e31-198b36030edb
📒 Files selected for processing (7)
src/lib/cron.tssrc/lib/fan-out.tssrc/lib/integrations.tssrc/lib/job-dispatcher.tssrc/routes/jobs.tssrc/routes/litigation.tssrc/routes/mcp.ts
💤 Files with no reviewable changes (1)
- src/lib/fan-out.ts
✅ Files skipped from review due to trivial changes (3)
- src/lib/cron.ts
- src/routes/mcp.ts
- src/routes/jobs.ts
The tool count increased from 38 to 43 after recent PRs added litigation and scrape tools. Test was stale. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
To use Codex here, create a Codex account and connect to github. |
|
🔐 Security
🚪 Policy Bypass Paths
📉 Regression Risk
🧱 Merge-Gating Bypass Attempts
Merge-blocking items (per repo policy): 🧠 Learnings used✅ Actions performedReview triggered.
|
… disable raw draft fallback - Generate UUID upfront in enqueueJob() and pass to both router and local fallback to prevent duplicate jobs on ambiguous timeout failures - Only fall back to local queue on definitive connection errors, not server errors - Warn about stuck local jobs in processQueue() when router is unavailable - Forward chittyId/offset to router in listJobs(), limit in getDeadLetters() - Return 503 error in litigation /draft when AI is disabled instead of leaking raw synthesizedFacts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
fan-out.ts— orchestration (Intelligence, Calendar, Triage, Ledger fan-out) now handled by ScrapeAgent DO-to-DO calls in ChittyRouterjob-dispatcher.ts— thin proxy to ChittyRouter/agents/scrape/*endpoints with Neon fallback for historical datarouterClient: enqueue, list, status, retry, dead-letters, processconnectClient:resolvePrompt()andexecutePrompt()calling ChittyConnect's TY-VY-RY governed prompt registrylitigation.ts— resolve prompts from ChittyConnect with fallback to direct AI Gateway until prompts are seededjobs.ts,mcp.ts,cron.ts— passenvthrough for router proxy delegationArchitecture
Net: -231 lines, scope violation resolved
Part of
3-repo extraction:
Test plan
tsc --noEmitpasses (verified locally)/synthesize→ tries ChittyConnect execute, falls back to AI Gatewaycourt_docketphase → enqueues via router proxy🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor
Chores
Tests