supertag-cli icon indicating copy to clipboard operation
supertag-cli copied to clipboard

[BUG] sync index --delta hangs after "Running delta-sync via Local API...", while Local API and full index work

Open ChenZhu-Xie opened this issue 5 months ago • 2 comments

Title: Windows 2.5.11: sync index --delta hangs after "Running delta-sync via Local API...", while Local API and full index work

Environment

  • OS: Windows 11
  • supertag.exe --version: 2.5.11
  • Workspace: main
  • Local API endpoint: http://127.0.0.1:8262
  • Tana Desktop Local API is enabled
  • Config file exists at: C:\Users\Xcz\.config\supertag\config.json
  • Database path: C:\Users\Xcz\.local\share\supertag\workspaces\main\tana-index.db

Problem

supertag.exe sync index -w main --delta --debug hangs indefinitely after:

[INFO]  [tana-sync]     Workspace: main
[INFO]  [tana-sync]     Database: C:\Users\Xcz\.local\share\supertag\workspaces\main\tana-index.db
[INFO]  [tana-sync]     Running delta-sync via Local API...

No timeout or error is printed, even with:

$env:TANA_LOCAL_API_URL="http://127.0.0.1:8262"
$env:SUPERTAG_LOCAL_API_TIMEOUT_MS="5000"
supertag.exe sync index -w main --delta --debug

When I interrupt it, PowerShell shows:

echo $LASTEXITCODE
-1073741510

Expected behavior

Delta sync should either complete successfully or fail with a clear error/timeout message.

Actual behavior

The process hangs after:

Running delta-sync via Local API...

It does not appear to respect SUPERTAG_LOCAL_API_TIMEOUT_MS=5000.

Local API checks

The Tana Local API itself appears to work.

Health check:

curl.exe -v --max-time 5 http://127.0.0.1:8262/health

Returns:

{"status":"ok","timestamp":"...","nodeSpaceReady":true}

Workspace list with bearer token also works:

$cfg = Get-Content "$env:USERPROFILE\.config\supertag\config.json" -Raw | ConvertFrom-Json
$token = $cfg.localApi.bearerToken
curl.exe -v --max-time 10 -H "Authorization: Bearer $token" http://127.0.0.1:8262/workspaces

Returns 200 OK:

[
  {
    "id": "VPMhVZzCmp-R",
    "name": "After SilverBullet",
    "homeNodeId": "MCS2ozPLJsLI"
  }
]

nodes/search with edited.since as epoch seconds also works:

$sinceSec = [DateTimeOffset]::UtcNow.AddDays(-1).ToUnixTimeSeconds()
$url = "http://127.0.0.1:8262/nodes/search?query%5Bedited%5D%5Bsince%5D=$sinceSec&limit=1&offset=0"
curl.exe -v --max-time 10 -H "Authorization: Bearer $token" $url

Returns 200 OK and a node result.

Full index works

A normal full index works:

supertag.exe sync index -w main --debug

Output:

[INFO]  [tana-sync]     Indexing latest export...
[INFO]  [indexer]       Change detection complete       added=0 modified=0      deleted=0       embeddingsCleared=0
[INFO]  [tana-sync]     Indexed: [email protected]
[INFO]  [tana-sync]     Changes: +0 added, ~0 modified, -0 deleted
[INFO]  [tana-sync]     Total Nodes: 17,159
[INFO]  [tana-sync]     Supertags: 46
[INFO]  [tana-sync]     Fields: 170
[INFO]  [tana-sync]     References: 72
[INFO]  [tana-sync]     Tag Applications: 642
[INFO]  [tana-sync]     Duration: 478ms (0.48s)
[INFO]  [tana-sync]     Syncing schema registry...
[INFO]  [tana-sync]     Schema: 46 supertags synced to C:\Users\Xcz\.local\share\supertag\workspaces\main\schema-registry.json

Search also works:

supertag.exe search "test" -w main --limit 3 --debug

Returns valid results.

Possible related issue: status still says "Last indexed: Never"

Even after a successful full index, sync status still reports:

[INFO]  [tana-sync]     Last indexed: Never
[INFO]  [tana-sync]     Delta Sync:
[INFO]  [tana-sync]       Last delta-sync: Never
[INFO]  [tana-sync]       Nodes synced: 0
[INFO]  [tana-sync]       Embedding coverage: 0.0% (17,161 nodes)

Full index clearly completed and local search works, but status does not seem to record/read the last full index timestamp.

This might be related to the delta-sync hang if delta sync depends on a full-sync watermark.

Notes

I originally tested /nodes/search using an ISO timestamp and got a 400 error:

{
  "code": "BAD_REQUEST",
  "message": "Input validation failed",
  "data": {
    "issues": [
      {
        "expected": "number",
        "code": "invalid_type",
        "received": "NaN",
        "path": ["query", "edited", "since"],
        "message": "Invalid input: expected number, received NaN"
      }
    ]
  }
}

After switching to epoch seconds, /nodes/search returns 200 OK, so the Local API search endpoint itself appears functional.

Summary

  • Local API health: OK
  • Local API auth/workspaces: OK
  • Local API nodes/search with epoch seconds: OK
  • Full export indexing: OK
  • Local SQLite search: OK
  • sync status: unexpectedly says Last indexed: Never
  • sync index --delta --debug: hangs indefinitely after Running delta-sync via Local API...
  • SUPERTAG_LOCAL_API_TIMEOUT_MS=5000 does not appear to trigger a timeout

ChenZhu-Xie avatar Jun 29 '26 16:06 ChenZhu-Xie

This looks related to https://github.com/jcfischer/supertag-cli/pull/85, but I also see Last indexed: Never after a successful full index.

ChenZhu-Xie avatar Jun 29 '26 16:06 ChenZhu-Xie

I can reproduce the exact edited.since issue described in this PR on Windows with supertag.exe 2.5.11.

Environment

  • OS: Windows 11
  • supertag-cli: 2.5.11
  • Tana Local API endpoint: http://127.0.0.1:8262
  • Workspace size: ~17,161 nodes
  • Full index works
  • Local SQLite search works
  • sync index --delta --debug hangs after:
[INFO]  [tana-sync]     Running delta-sync via Local API...

No timeout or error is printed, even with:

$env:TANA_LOCAL_API_URL="http://127.0.0.1:8262"
$env:SUPERTAG_LOCAL_API_TIMEOUT_MS="5000"
supertag.exe sync index -w main --delta --debug

When I interrupt it, PowerShell shows:

echo $LASTEXITCODE
-1073741510

Local API itself works

Health check works:

curl.exe -v --max-time 5 http://127.0.0.1:8262/health

Returns:

{"status":"ok","timestamp":"...","nodeSpaceReady":true}

Workspace list with bearer token also works:

$cfg = Get-Content "$env:USERPROFILE\.config\supertag\config.json" -Raw | ConvertFrom-Json
$token = $cfg.localApi.bearerToken
curl.exe -v --max-time 10 -H "Authorization: Bearer $token" http://127.0.0.1:8262/workspaces

Returns 200 OK:

[
  {
    "id": "VPMhVZzCmp-R",
    "name": "After SilverBullet",
    "homeNodeId": "MCS2ozPLJsLI"
  }
]

edited.since appears to be ignored

I directly probed Tana Desktop Local API with different edited.since values:

function Test-TanaSince($label, $sinceSec) {
  $url = "http://127.0.0.1:8262/nodes/search?query%5Bedited%5D%5Bsince%5D=$sinceSec&limit=5&offset=0"
  Write-Host "`n=== $label : $sinceSec ==="
  curl.exe -s --max-time 10 -H "Authorization: Bearer $token" $url
}

Test-TanaSince "5 minutes ago" ([DateTimeOffset]::UtcNow.AddMinutes(-5).ToUnixTimeSeconds())
Test-TanaSince "1 hour ago"    ([DateTimeOffset]::UtcNow.AddHours(-1).ToUnixTimeSeconds())
Test-TanaSince "1 day ago"     ([DateTimeOffset]::UtcNow.AddDays(-1).ToUnixTimeSeconds())
Test-TanaSince "1 year ago"    ([DateTimeOffset]::UtcNow.AddYears(-1).ToUnixTimeSeconds())
Test-TanaSince "epoch-ish"     1

All five calls return the same first 5 node IDs:

6vPIui4vgLbw
AlCuIX0pexmb
MP_kp0MoAWtb
mfeJySaNBw8B
3VVLm7rq_oFo

So the Local API appears to accept query[edited][since] as a numeric epoch-seconds value and returns 200 OK, but the filter is ignored.

For comparison, passing an ISO timestamp returns a validation error, so numeric epoch seconds seem to be the expected input type:

{
  "code": "BAD_REQUEST",
  "message": "Input validation failed",
  "data": {
    "issues": [
      {
        "expected": "number",
        "code": "invalid_type",
        "received": "NaN",
        "path": ["query", "edited", "since"],
        "message": "Invalid input: expected number, received NaN"
      }
    ]
  }
}

Full index works

A normal full index works:

supertag.exe sync index -w main --debug

Output:

[INFO]  [tana-sync]     Indexing latest export...
[INFO]  [indexer]       Change detection complete       added=0 modified=0      deleted=0       embeddingsCleared=0
[INFO]  [tana-sync]     Indexed: [email protected]
[INFO]  [tana-sync]     Changes: +0 added, ~0 modified, -0 deleted
[INFO]  [tana-sync]     Total Nodes: 17,159
[INFO]  [tana-sync]     Supertags: 46
[INFO]  [tana-sync]     Fields: 170
[INFO]  [tana-sync]     References: 72
[INFO]  [tana-sync]     Tag Applications: 642
[INFO]  [tana-sync]     Duration: 478ms (0.48s)
[INFO]  [tana-sync]     Syncing schema registry...
[INFO]  [tana-sync]     Schema: 46 supertags synced to C:\Users\Xcz\.local\share\supertag\workspaces\main\schema-registry.json

Search also works:

supertag.exe search "test" -w main --limit 3 --debug

Returns valid results.

Additional observation: sync status still says Last indexed: Never

Even after a successful full index, sync status still reports:

[INFO]  [tana-sync]     Last indexed: Never
[INFO]  [tana-sync]     Delta Sync:
[INFO]  [tana-sync]       Last delta-sync: Never
[INFO]  [tana-sync]       Nodes synced: 0
[INFO]  [tana-sync]       Embedding coverage: 0.0% (17,161 nodes)

This may be separate from the edited.since issue, but it might affect delta-sync watermark/metadata handling.

Summary

  • Local API health: OK
  • Local API auth/workspaces: OK
  • Local API /nodes/search with numeric epoch-seconds edited.since: returns 200 OK
  • But different edited.since values return the same first page, so the filter appears to be ignored
  • Full export indexing: OK
  • Local SQLite search: OK
  • sync status: unexpectedly says Last indexed: Never
  • sync index --delta --debug: hangs indefinitely after Running delta-sync via Local API...
  • SUPERTAG_LOCAL_API_TIMEOUT_MS=5000 does not appear to trigger a timeout

Current workaround: use full sync without --delta, which is fast on this workspace.

ChenZhu-Xie avatar Jun 29 '26 17:06 ChenZhu-Xie