You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: ship SQL pre-validation in shadow mode, defer other fixes
Reduces PR scope to telemetry-only based on deep analysis: the broader
fixes (prompt rules, warehouse_test guidance, apply_patch retry, read
file-not-found cache, altimate_core_validate auto-pull) were speculative
against an 8-machine / 1-day telemetry sample.
This PR now ships only what's needed to measure whether pre-execution
SQL validation is worth it:
- Keep: sql_pre_validation telemetry event + preValidateSql function
- Change: pre-validation runs fire-and-forget (shadow mode) — emits
telemetry with outcome=skipped|passed|blocked|error but never blocks
sql_execute. Zero user-facing latency impact.
- Revert: read.ts, apply_patch.ts, warehouse-test.ts, altimate-core-validate.ts,
anthropic.txt system prompt changes — to be re-evaluated as separate
PRs once real telemetry data validates need.
After 2 weeks of shadow telemetry, we can decide whether the blocking
behavior is worth the latency and false-positive risk.
"No schema provided. Provide schema_context or schema_path so table/column references can be resolved. Tip: run schema_index first to cache your warehouse schema."
19
+
"No schema provided. Provide schema_context or schema_path so table/column references can be resolved."
return"\n\nHow to fix: Check the password in your connection config. Verify the username has access from your current IP address. Use `warehouse_remove` then `warehouse_add` to re-enter credentials."
49
-
}
50
-
if(lower.includes("password must be a string")||lower.includes("scram")){
51
-
return"\n\nHow to fix: The password field is missing or not a string. Check your connection config — the password may be empty or set to a non-string value. Use `warehouse_remove` then `warehouse_add` to re-configure."
return"\n\nHow to fix: Key pair authentication failed. Verify: (1) the key file is PEM/PKCS#8 format, (2) the passphrase is correct, (3) the key has not expired, (4) the public key is registered in your warehouse."
return"\n\nHow to fix: No password was provided. Use `warehouse_remove` then `warehouse_add` to configure credentials. For Snowflake, you can also use key pair or SSO authentication."
return"\n\nHow to fix: SSO browser authentication timed out. Ensure your default browser opened the auth page. If running in a headless environment, switch to password or key pair authentication instead."
return"\n\nHow to fix: Cannot reach the database server. Check: (1) the hostname and port are correct, (2) the server is running, (3) any firewalls or VPNs are configured to allow the connection."
67
-
}
68
-
if(lower.includes("schema")&&(lower.includes("does not exist")||lower.includes("not authorized"))){
69
-
return"\n\nHow to fix: The specified schema does not exist or your user lacks access. Check: (1) the schema name is spelled correctly, (2) your user/role has USAGE privilege on the schema."
Copy file name to clipboardExpand all lines: packages/opencode/src/session/prompt/anthropic.txt
+1-19Lines changed: 1 addition & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -69,27 +69,9 @@ I've found some existing telemetry code. Let me mark the first todo as in_progre
69
69
70
70
# Doing tasks
71
71
The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
72
-
-
72
+
-
73
73
- Use the TodoWrite tool to plan the task if required
- Start working immediately. Do NOT ask clarifying questions unless the request is genuinely ambiguous with multiple incompatible interpretations.
80
-
- If you can make a reasonable assumption, make it and state what you assumed. The user can correct you.
81
-
- Prefer taking a small action (scan the project, read a file, check the schema) over asking the user what to do.
82
-
83
-
## Always read before editing
84
-
- NEVER call edit, write, or apply_patch on a file you have not read in the current session.
85
-
- If apply_patch fails with "Failed to find expected lines", re-read the file immediately and generate a new patch from the fresh content. Do NOT retry the same patch.
86
-
- After a file_not_found error on a specific path, do NOT attempt to read that same path again. Move on or ask the user.
87
-
88
-
## Limit retries
89
-
- If a tool call fails twice on the same input, do NOT retry a third time. Instead, explain what went wrong and try an alternative approach.
90
-
- If apply_patch or edit fails on the same file twice, re-read the file, then try once more with fresh content. If that also fails, stop and report the issue.
91
-
<!-- altimate_change end -->
92
-
93
75
- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are automatically added by the system, and bear no direct relation to the specific tool results or user messages in which they appear.
`apply_patch verification failed: ${retryError}\n\nThe file has been modified since you last read it. Please re-read the file and generate a new patch.`,
118
-
)
119
-
}
120
-
}else{
121
-
thrownewError(
122
-
`apply_patch verification failed: ${error}\n\nThe expected lines were not found in the file. Please re-read the file and generate a new patch based on its current contents.`,
// altimate_change start — cache file-not-found to prevent retry loops
59
-
if(_notFoundCache.has(filepath)){
60
-
thrownewError(
61
-
`File not found: ${filepath}\n\nThis path was already checked and does not exist. Do NOT retry. Use a different path or ask the user for the correct location.`,
0 commit comments