Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/completeness.md
Original file line number Diff line number Diff line change
Expand Up @@ -1775,6 +1775,10 @@ source counts, and the reader checks the source again before publication.
Doctor counts these transcripts separately. Full-source exports and format
qualification still require full coverage.

The `boardpost157` rule covers a failed, resultless `post_message` from a killed
swarm member. The stored text argument and tool call must agree, and the short
and full errors must name the same member. The daemon retains the whole step.

The `killall1512` profile verifies the observed single-child `kill_all`
result against the child's identity in both persisted result lists. The
presented action and both ID strings must match.
2 changes: 2 additions & 0 deletions internal/completeness/projection_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,8 @@ func qualifyResultless(step, generic protoreflect.Message) (proto.Message, error
}
var args []string
switch tool {
case "post_message":
return nil, qualifyFailedBoardPost(step, generic)
case "swarm":
return nil, qualifyFailedSwarm156(step, generic)
case "define_subagent":
Expand Down
29 changes: 29 additions & 0 deletions internal/completeness/projection_swarm155.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"strconv"
"strings"

"google.golang.org/protobuf/reflect/protoreflect"
)
Expand Down Expand Up @@ -57,3 +58,31 @@ func qualifySwarm155(step, generic, result protoreflect.Message) error {
}
return nil
}

// qualifyFailedBoardPost checks the resultless ERROR wrapper from a member
// killed before its post reached the board. The daemon retains it unchanged.
func qualifyFailedBoardPost(step, generic protoreflect.Message) error {
const prefix = "failed to post to the board: member was killed: "
unsupported := errors.New("unsupported failed board post")
if !errorStartsWith(step, prefix) {
return unsupported
}
outer := tool143Get(step, "error").Message()
short := tool143Get(outer, "short_error").String()
quoted := strings.TrimPrefix(short, prefix)
member, err := strconv.Unquote(quoted)
if err != nil || member == "" || strconv.Quote(member) != quoted || tool143Get(outer, "full_error").String() != short {
return unsupported
}
call := tool143Get(tool143Get(step, "metadata").Message(), "tool_call").Message()
if !objectKeysUnique([]byte(tool143Get(call, "arguments_json").String())) {
return unsupported
}
called, ok := calledArguments(step)
text, isString := literalString(called["text"])
stored, present := genericArg(generic, "text")
if !ok || len(called) != 1 || !isString || text == "" || !present || stored != text || !genericArgsAllowed(generic, "text") {
return unsupported
}
return nil
}
29 changes: 29 additions & 0 deletions internal/completeness/projection_tools155_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,32 @@ func TestTimestampedImageRead155(t *testing.T) {
require1216(t, snapshot1216(t, badRaw), badRaw, badShown, Unknown)
}
}

func TestFailedBoardPost(t *testing.T) {
const raw = `{"cascadeId":"fixture","steps":[{"type":"CORTEX_STEP_TYPE_GENERIC","status":"CORTEX_STEP_STATUS_ERROR","metadata":{"toolCall":{"name":"post_message","argumentsJson":"{\"text\":\"hello\"}"}},"generic":{"args":{"text":"hello"}},"error":{"shortError":"failed to post to the board: member was killed: \"worker\"","fullError":"failed to post to the board: member was killed: \"worker\""}}]}`
s := snapshot1216(t, raw)
require1216(t, s, raw, raw, Verified)
offline, err := s.OfflineJSON()
if err != nil {
t.Fatal(err)
}
require1216(t, s, raw, string(offline), Verified)
changed := strings.ReplaceAll(raw, "hello", "changed")
require1216(t, s, raw, changed, Incomplete)
for _, m := range [][2]string{
{"CORTEX_STEP_STATUS_ERROR", "CORTEX_STEP_STATUS_DONE"},
{"member was killed", "member left"},
{`\"worker\"`, `\"\"`},
{`"fullError":"failed`, `"fullError":"unexpected: failed`},
{`"text":"hello"`, `"text":"other"`},
{`"args":{`, `"result":{},"args":{`},
{`"args":{`, `"args":{"extra":"argument",`},
{`{\"text\":\"hello\"}`, `{\"text\":\"other\",\"text\":\"hello\"}`},
} {
bad := strings.ReplaceAll(raw, m[0], m[1])
if bad == raw {
t.Fatal("mutation missed", m)
}
require1216(t, snapshot1216(t, bad), bad, bad, Unknown)
}
}
2 changes: 1 addition & 1 deletion internal/completeness/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ import (
// policy1510 retains the three PolicyGuardianConfig fields observed in executor metadata.
// refs1511 retains the observed agy 1.5.11 render-reference fields.
// tools1512 projects the observed skill, file, command, timer and list results.
const Profile = "sqlite-v1-format0-agy-1.3.4-5b93565c5f04-planner50-permission2-prompt23-tools143-permission1-tools144-skill1-history2-ide225-options145-compaction146-skill146-finish147-replay147-failedread146-subagents148-media149-tools149-sendmessage149-files1411-media1410-parentmsgs1410-paths1410-denied1412-cwd1412-unrun1412-config150-skill150-frontmatter150-bgcancel150-readlines150-config152-tools153-tools154-tools155-images155-tools156-retained156-legacychoices156-runtime157-planexecute157-tools158-workflow159-schedule1510-policy1510-refs1511-tools1512-killall1512"
const Profile = "sqlite-v1-format0-agy-1.3.4-5b93565c5f04-planner50-permission2-prompt23-tools143-permission1-tools144-skill1-history2-ide225-options145-compaction146-skill146-finish147-replay147-failedread146-subagents148-media149-tools149-sendmessage149-files1411-media1410-parentmsgs1410-paths1410-denied1412-cwd1412-unrun1412-config150-skill150-frontmatter150-bgcancel150-readlines150-config152-tools153-tools154-tools155-images155-tools156-retained156-legacychoices156-runtime157-planexecute157-tools158-workflow159-schedule1510-policy1510-refs1511-tools1512-killall1512-boardpost157"
const maxBytes = 64 << 20
const maxDepth = 100

Expand Down
3 changes: 2 additions & 1 deletion internal/completeness/tools158_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ func TestCurrentProfileInvalidatesPreviousAttestations(t *testing.T) {
strings.Split(Profile, "-policy1510")[0],
strings.Split(Profile, "-refs1511")[0],
strings.Split(Profile, "-tools1512")[0],
strings.TrimSuffix(Profile, "-killall1512"),
strings.Split(Profile, "-killall1512")[0],
strings.TrimSuffix(Profile, "-boardpost157"),
} {
a.Profile = previous
if a.Profile == Profile {
Expand Down
Loading