[agent/codex:gpt-5.3-codex-spark] Update the code against the AX (Agent Experience) design pri... #12

Merged
Virgil merged 1 commit from agent/update-the-code-against-the-ax--agent-ex into dev 2026-03-30 00:10:48 +00:00
2 changed files with 37 additions and 1 deletions

View file

@ -945,7 +945,7 @@ func splitTrailingPunct(s string) (string, string) {
// Check single-char trailing punctuation.
if len(s) > 1 {
last := s[len(s)-1]
if last == '?' || last == ':' || last == '!' || last == ';' || last == ',' {
if last == '?' || last == ':' || last == '!' || last == ';' || last == ',' || last == '.' || last == ')' || last == ']' || last == '}' {
return s[:len(s)-1], string(last)
}
}
@ -968,6 +968,14 @@ func matchPunctuation(punct string) (string, bool) {
return "separator", true
case ",":
return "comma", true
case ".":
return "sentence_end", true
case ")":
return "close_paren", true
case "]":
return "close_bracket", true
case "}":
return "close_brace", true
}
return "", false
}

View file

@ -259,6 +259,34 @@ func TestTokeniser_Tokenise_Punctuation(t *testing.T) {
}
}
func TestTokeniser_Tokenise_ClauseBoundarySentence(t *testing.T) {
setup(t)
tok := NewTokeniser()
tokens := tok.Tokenise("run tests. commit")
hasSentenceEnd := false
for _, token := range tokens {
if token.Raw == "run" && token.Type != TokenVerb {
t.Errorf("'run' should remain TokenVerb, got %v", token.Type)
}
if token.Type == TokenPunctuation && token.PunctType == "sentence_end" {
hasSentenceEnd = true
}
if token.Lower == "commit" {
// Without sentence-end boundary support, this can be demoted by verb saturation.
// With boundary detection, it should still classify as a verb.
if token.Type != TokenVerb {
t.Errorf("'commit' after period should be TokenVerb, got %v", token.Type)
}
}
}
if !hasSentenceEnd {
t.Error("did not detect sentence-end punctuation in \"run tests. commit\"")
}
}
func TestTokeniser_Tokenise_Empty(t *testing.T) {
setup(t)
tok := NewTokeniser()