fix: simplify walkthrough prompt requests (#1660)
* fix: simplify walkthrough prompt requests * fix: address walkthrough review feedback
This commit is contained in:
@@ -26,7 +26,10 @@ const overloaded529Message = "Internal error: API Error: 529 Overloaded. This is
|
||||
// before recovering (default 1, so the turn self-heals on the first retry).
|
||||
// Use a large N (e.g. `/overloaded:9`) to exhaust the retry budget and fall
|
||||
// through to the red recovery banner.
|
||||
var overloadedCmdRe = regexp.MustCompile(`(?i)^/(?:e2e:)?overloaded(?::(\d+))?$`)
|
||||
var (
|
||||
overloadedCmdRe = regexp.MustCompile(`(?i)^/(?:e2e:)?overloaded(?::(\d+))?$`)
|
||||
changesWalkthroughPromptRefRe = regexp.MustCompile(`^@changes-walkthrough(?:\s|$)`)
|
||||
)
|
||||
|
||||
const changesWalkthroughPromptMarker = "Please create an agent-authored walkthrough of the current changes"
|
||||
|
||||
@@ -35,8 +38,7 @@ func isChangesWalkthroughRequest(prompt string) bool {
|
||||
legacyPrompt := strings.Contains(cmd, changesWalkthroughPromptMarker) &&
|
||||
strings.Contains(cmd, "show_walkthrough_kandev") &&
|
||||
strings.Contains(cmd, "Available changed files:")
|
||||
promptReference := strings.Contains(cmd, "@changes-walkthrough") &&
|
||||
strings.Contains(cmd, "Changed files:")
|
||||
promptReference := changesWalkthroughPromptRefRe.MatchString(cmd)
|
||||
return legacyPrompt || promptReference
|
||||
}
|
||||
|
||||
|
||||
@@ -124,9 +124,6 @@ func TestIsChangesWalkthroughRequest(t *testing.T) {
|
||||
promptReference := strings.Join([]string{
|
||||
"@changes-walkthrough",
|
||||
"",
|
||||
"Changed files:",
|
||||
"- src/app.ts [uncommitted]",
|
||||
"",
|
||||
"<kandev-system>",
|
||||
"EXPANDED PROMPT REFERENCES",
|
||||
"### @changes-walkthrough",
|
||||
@@ -142,6 +139,9 @@ func TestIsChangesWalkthroughRequest(t *testing.T) {
|
||||
if isChangesWalkthroughRequest("show_walkthrough_kandev without the generated prompt shape") {
|
||||
t.Fatal("expected unrelated prompt not to be detected")
|
||||
}
|
||||
if isChangesWalkthroughRequest("what does @changes-walkthrough do?") {
|
||||
t.Fatal("expected incidental prompt reference not to be detected")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDelayRange(t *testing.T) {
|
||||
|
||||
@@ -851,8 +851,8 @@ func walkthroughDemoArgs() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
wtKeyTitle: "Tour of the change",
|
||||
wtKeySteps: []map[string]interface{}{
|
||||
wtStep("Entry point", "walkthrough_a.txt",
|
||||
"Execution starts here. **Step 1** explains the entry point in file A.", 1, 0),
|
||||
wtStep("Overview", "walkthrough_a.txt",
|
||||
"Big picture: this tour explains how the sample changes connect across the touched files.\n\nELI5: first we show the map, then we explain each changed line.", 1, 0),
|
||||
wtStep("The change in A", "walkthrough_a.txt",
|
||||
"Step 2: this is WALKTHROUGH_CHANGE_A the tour narrates.", 2, 3),
|
||||
wtStep("File B", "walkthrough_b.txt",
|
||||
|
||||
Reference in New Issue
Block a user