Skip to content
Draft
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
6 changes: 6 additions & 0 deletions docs/design/decision-references.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ Production source and license were fetched and independently checked on 2026-11-

The Go port specializes `useResume=true` in a resume-only API and keeps RawClaw's existing argv builder and shell renderer. Only a known Claude source receives the configured fork capability; the ordinary unknown-source fallback does not confer it. CLI changes pass the explicit option and errors through existing selected local and foreign matches, preserving ambiguity, metadata guards, source-filter rejection and archive origin guidance. RawClaw renders a command; this source record does not establish native execution or creation of a new session ID. No OpenClaw package, checkpoint feature, transcript copying or new discovery policy is adopted.

## Reading optional session topics

Netronome [compares the full SQLite error string for each optional table](https://github.com/autobrr/netronome/blob/200757072afce58ca0e0442984cff6860fa4360d/internal/database/user.go#L199-L202) and [returns other database errors](https://github.com/autobrr/netronome/blob/200757072afce58ca0e0442984cff6860fa4360d/internal/database/user.go#L34-L38). RawClaw uses the same comparison with its `topic_segment` table. [Netronome license](https://github.com/autobrr/netronome/blob/200757072afce58ca0e0442984cff6860fa4360d/LICENSE).

Grafana [compares the exact missing-table diagnostic](https://github.com/grafana/grafana/blob/71ceb636f6405679f02c5f57c7fe222c801cad3b/pkg/services/sqlstore/migrator/sqlite_dialect.go#L167-L173) when a SQLite table is optional and propagates other failures. RawClaw uses this distinction for the unqualified `topic_segment` query. Its [pinned Go driver formats the SQLite message with the error description and numeric code](https://github.com/modernc-org/sqlite/blob/b8975b7dcf269f7c09929073c1feb64701066f41/conn.go#L626-L640). SQLite's [view regression](https://github.com/sqlite/sqlite/blob/c2aa8e3875907d84540af7624534e326b26b82ee/test/view.test#L89-L99) shows how a missing source table causes a different diagnostic when the view itself exists. [Grafana license](https://github.com/grafana/grafana/blob/71ceb636f6405679f02c5f57c7fe222c801cad3b/LICENSE) · [Driver license](https://github.com/modernc-org/sqlite/blob/b8975b7dcf269f7c09929073c1feb64701066f41/LICENSE) · [SQLite dedication](https://github.com/sqlite/sqlite/blob/c2aa8e3875907d84540af7624534e326b26b82ee/LICENSE.md).

## Crush SQLite reader source candidate (2026-11-06)

Source: `kenn-io/agentsview` at immutable revision `5f877363f3a7b911e73dc391692c66cd835da7be`; the linked files own these patterns.
Expand Down
6 changes: 5 additions & 1 deletion internal/store/topics.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ func TopicsForSession(con *sql.DB, sessionID string) ([]TopicSegment, error) {
"SELECT session_id, start_uuid, end_uuid, topic, summary, tagged_at, origin_machine FROM topic_segment WHERE session_id=? ORDER BY id",
sessionID)
if err != nil {
return nil, nil // missing table / read error reads as no topics (non-fatal)
// SQLite uses the same error code for missing tables and other SQL errors.
if err.Error() == "SQL logic error: no such table: topic_segment (1)" {
return nil, nil // missing optional table reads as no topics (non-fatal)
}
return nil, err
}
defer rows.Close()
var out []TopicSegment
Expand Down
19 changes: 19 additions & 0 deletions internal/store/topics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,25 @@ func TestSessionHasRealSegments(t *testing.T) {
})
}

func TestTopicsForSessionReadErrors(t *testing.T) {
con, _ := storetest.NewDB(t)
if got, err := store.TopicsForSession(con, "sess-1"); err != nil || len(got) != 0 {
t.Fatalf("missing optional table: got %v, %v; want no topics", got, err)
}
if _, err := con.Exec("CREATE VIEW topic_segment AS SELECT * FROM topic_segment_archive"); err != nil {
t.Fatal(err)
}
if _, err := store.TopicsForSession(con, "sess-1"); err == nil {
t.Fatal("expected an error for a view with a missing source table")
}
if err := con.Close(); err != nil {
t.Fatal(err)
}
if _, err := store.TopicsForSession(con, "sess-1"); err == nil {
t.Fatal("expected an error for a closed database")
}
}

func TestInsertTopicSegments(t *testing.T) {
con, _ := storetest.NewDB(t)
if err := store.EnsureTopicSchema(con); err != nil {
Expand Down