feat(gastown): pass GASTOWN_TOWN_ID to container on provision#2095
Conversation
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Other Observations (not in diff)The earlier direct-merge starvation caused by fast-tracking beads without a real Files Reviewed (3 files)
Reviewed by gpt-5.4-2026-03-05 · 816,617 tokens |
- Sanitize HTML comments and tags from review comment bodies before interpolating into LLM prompt to prevent prompt injection attacks (Town.do.ts:4384) - Track fast-tracked MR bead IDs in a Set and exclude them from Rules 5-6 dispatch logic so refinery isn't dispatched for beads that were transitioned to in_progress in the same reconciliation pass (reconciler.ts:1180)
…de_review disabled
|
|
- Prompt injection fix (Town.do.ts): Escape comment bodies with backslash escaping for backslashes, backticks, and newlines. Wrap each comment in inline code fences and each thread in a fenced code block. - Direct-merge regression fix (reconciler.ts): Only fast-track PR-strategy open MR beads (those with pr_url IS NOT NULL) when code_review=false. Direct-merge MRs (no pr_url) now remain in 'open' status so Rules 5-6 can properly dispatch the refinery to perform the merge.
1fab718 to
9b5b6d4
Compare
- Town.do.ts: Escape backslashes, backticks, and newlines in review comment text before interpolating into LLM prompt to mitigate prompt injection risk from malicious reviewer comments. - reconciler.ts: Only fast-track PR-strategy MR beads (those with pr_url) when code_review=false. Direct-merge MR beads (no pr_url) still need the refinery to perform the merge and must not be fast-tracked.
- container-dispatch.ts: restore GASTOWN_TOWN_ID env var in ensureContainerToken and forceRefreshContainerToken - reconciler.ts: exclude empty-string pr_url in Rule 1 and Rule 4 to prevent misclassifying empty-string URLs as PR-strategy beads - Town.do.ts: wrap commentText in triple backtick code fences to prevent prompt injection in LLM merge gate
9b5b6d4 to
2e68e14
Compare
2e68e14 to
6d83d57
Compare
|
Closing duplicate/broken PR. This work is correctly tracked in PR #2099. |
- Town.do.ts: escape backticks in comment bodies to prevent prompt injection - reconciler.ts: filter oldestMr query to exclude PR-strategy beads (pr_url IS NOT NULL), ensuring Rules 5-6 only processes direct-merge beads
- reconciler.ts: filter oldestMr query to only direct-merge beads (pr_url IS NULL), preventing PR-strategy beads from slipping into refinery dispatch
- Town.do.ts: areThreadsBlocking now filters to only unresolved threads, returning false early when no unresolved threads remain. This prevents resolved threads from being interpolated into the LLM prompt. - reconciler.ts: Count only this rig's fast-tracked beads when computing blockingCount, not all rigs' fast-tracked beads combined. The PR-strategy MR fast-track comment (reconciler.ts:1166) was addressed in an earlier revision: beads are only fast-tracked when pr_url is populated, which excludes direct-merge beads.
jrf0110
left a comment
There was a problem hiding this comment.
All review comments have been addressed:
-
Town.do.ts:4384 (Prompt injection) - Fixed by filtering threads to only unresolved ones before processing. Returns false early when no unresolved threads remain.
-
reconciler.ts:1259 (Global fast-track count) - Fixed by filtering fastTrackedBeadIds to only count beads belonging to the current rig_id.
-
reconciler.ts:1166 (PR-strategy pr_url pending) - The current implementation correctly only fast-tracks beads with non-empty pr_url. Beads with null pr_url remain in 'open' status and Rules 5-6 will dispatch the refinery normally.
- Town.do.ts: areThreadsBlocking filters to only unresolved threads, returning false early when no unresolved threads remain. - reconciler.ts: Add fastTrackedBeadIds Set, filter fast-track query to only PR-strategy beads (with pr_url), and count only this rig's fast-tracked beads when computing blockingCount.
Summary
GASTOWN_TOWN_IDenv var in bothensureContainerToken()andforceRefreshContainerToken()incontainer-dispatch.tsto ensure containers know their town identity on cold boot.Town.do.ts— comment bodies are escaped for backslashes, backticks, and newlines, with each comment wrapped in inline code fences and each thread in a fenced code block.fastTrackedBeadIdsSet inreconciler.tsto track all MR beads transitioned toin_progressin the same reconciliation pass. Rules 5-6 now exclude these beads via SQL NOT IN clauses, preventing same-tick refinery dispatch.Verification
Visual Changes
N/A
Reviewer Notes
N/A