mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #4710] [Bug] SQLite inventory row sampling duplicates values when decoded column names collide #2459
Closed
opened 2026-10-17 21:05:00 +00:00 by bsakaguchi
·
5 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#2459
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @coygeek on GitHub (Oct 17, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/4710
Before submitting
Area
Evidence, artifacts, or reconstruction
Observed behavior
inspect-sqlite-databasewith--schema-scope inventory --table tand omitted columns returns successful but incorrect row Evidence for an authored SQLite snapshot. The first column has malformed UTF-8 name bytesFF6F6C; a separate valid column has name�ol, bytesEFBFBD6F6C. Both names decode to�ol. Automatic selection returns columns["�ol", "�ol"]and values["replacement-column", "replacement-column"], losing the first column's value from the sample. A read-onlySELECT *returns["first-column", "replacement-column"]from the unchanged file.Reproduction
Use the built source checkout and pinned runtime listed below. From the checkout root, run these commands.
scripts/rea.mjsis also the entrypoint inside the separately installed npm package.Both commands exit 0. The valid control retains both original values; the malformed copy repeats the second value. The script changes one byte in the stored declaration after closing SQLite and preserves the row payload.
Run this read-only oracle on the malformed copy to distinguish incorrect projection from display replacement:
The oracle returns name bytes
FF6F6CandEFBFBD6F6C, with row valuesfirst-columnandreplacement-column.Discriminating controls used a fresh HOME per CLI invocation. On the malformed collision file, inventory with
--column '�ol'returns the single correct valuereplacement-column. Omitting--schema-scope inventory, or selecting--schema-scope database, refuses the file with a typed path/invalid_formaterror for malformed UTF-8 schema SQL. A separate table with a malformed name and an unaffectedsafecolumn returns the correct subset whensafeis explicitly selected. Automatic projection without a colliding valid identifier correctly returns a typed format refusal.Expected behavior
Omitting columns selects all visible columns. A successful sample must preserve each selected column's identity and value. If faithful selection is unavailable for malformed identifiers, a meaningful typed malformed-format refusal is acceptable. Compact inventory should continue to omit SQL declarations and expanded column details, with
columns_completeness: "not_requested". This report does not require inventory to expand or validate every stored declaration.Impact and scope
The failure produces misleading successful row evidence on the authored malformed-name collision. It leaves the source bytes unchanged. Both tested builds reproduced the collision once in an eleven-case public CLI matrix per build. The exact reproduction blocks above were also replayed separately as described below. This establishes behavior on these fixtures, not the frequency of malformed names in ordinary databases. Other encodings, runtimes and MCP execution were not tested.
REA version
Fresh source build at main commit
264799b0ff501b2d2da36153fd3afbc063ab9ef4, reporting6.5.0, and a separate install of the latest published npm packagerea-agents@6.5.0, also reporting6.5.0. The runtime failure reproduced on both.Runtime and platform
Node v24.18.0 and npm 11.16.0, matching the source toolchain pins; macOS 27.0.1 arm64; observed SQLite 3.53.1. CLI invocations used isolated HOME directories with no ambient client configuration. The source build completed with
npm ciandnpm run build:cached.Target and artifact context
An authored, closed, 8192-byte UTF-8 SQLite database with one ordinary table, two TEXT columns, one row and no WAL or rollback journal. The malformed copy changes only the first column name's initial byte. No private database or active analysis target was involved.
Interface
CLI
Earliest failure stage
Capture or observation
Relevant output or evidence
docs/sqlite-databases.md:44-60documents independent schema scope and row selection, including all visible columns by default.src/domain/sqlite/sqliteDatabase.ts:25-85permits explicit inventory with a table and omitted columns.src/sqlite/SqliteDatabaseInspection.ts:186-209,:297-318,:348-365and:426-455locate column discovery, inventory omission and row projection.Both automatic inventory requests exit 0 and return
confidence: "observed". Reduced row fields are:Every successful inventory control retained
scope: "inventory",completeness: "complete",columns: [], andcolumns_completeness: "not_requested", with no SQL declaration. That completeness describes inventory scope; it does not justify the incorrect row values. The two-column collision results also retaincolumn_count: 2.The eleven-case matrix per build covered valid and malformed single-column tables, valid and malformed tables with an unaffected column, the valid and malformed collision controls, explicit selections, and default/database guards. All 22 outcomes were parsed and asserted. Before/after SHA-256 values matched for all six fixtures. A separate read-only oracle confirmed distinct raw names and retained row values. Exact reproduction replay used newly authored files and fresh homes for each build.
Typed outcome or recovery expected
For automatic selection on the collision fixture, return faithful data for both distinct stored columns or a meaningful typed format refusal. Preserve successful distinct values on the valid control, correct explicit valid-column subsets, the existing expanded-scope malformed-SQL guard, and compact inventory's
not_requestedsemantics.Analysis or suspected cause
Source-derived reasoning: inventory omits stored SQL decoding but reads selected-table columns internally through
PRAGMA table_xinfo. The binding supplies decoded strings, so both names become�ol. Automatic projection quotes that string twice, and both expressions resolve to the valid second column. The result dimensions still match and the incorrect sample passes validation. Expanded scopes decode stored SQL first and refuse this malformed declaration.Additional context
The observed defect requires explicit inventory, table selection, omitted columns and a malformed/valid identifier collision. The default-scope format refusal is correct. Open and closed issue and PR searches found no matching report. Existing SQLite reports about selected-schema budgets, path resolution, symlink identity and rejected-column metadata have different triggers and outcomes. No last-known-good version was established.
@xu91102 commented on GitHub (Oct 17, 2026):
Independently reproduced on a fresh build of main
c6b62754b095a134d6d67877508fa34311a2eda2, Node24.18.0 / SQLite3.53.1 on macOS arm64, through the actual CLI and authored closed snapshots. The raw namesFF6F6C/EFBFBD6F6Cremain distinct; the read-only original row isfirst-column, second-column, while automatic inventory returnedsecond-columntwice. Seven CLI controls, explicit valid subsets, expanded malformed-SQL rejection and unchanged hashes for all four fixtures were verified.The correction is pushed to my fork: 700b169. It rejects ambiguous automatic projection in the existing row-selection owner before quoted identifiers can select the same native column. Independent review exposed the ASCII-equivalent variant (
FF4F4Cdecoding to �OL beside valid �ol), which I also reproduced and fixed using the existing SQLite ASCII identifier key. Exact explicit selections, deliberate duplicate valid columns, Unicode distinctions and compact inventory omission remain intact. Related4021/4216/2701 actual diffs do not fix this collision.Final semantic coverage:10 files122PASS3conditionalSKIP, plus README5PASS; a later single formatting-only line reflow was exactly verified, followed by final check/docs/discovery and a fresh seven-call CLI matrix. Actual compiled CLI and official SDK stdioMCP regressions verify typed refusals, ping and same-connection recovery, explicit subsets, text/structured parity and unchanged source bytes. Independent Standards/Spec review passed after that correction; normal commit/push preserved frozen bytes. Windows/Linux, external-database prevalence and performance are not qualified. No upstream PR or upstream CI exists because ordinary creation remains permission-blocked; no human readiness is attested.
Update (2026-10-17): main commit
748ac7f0dfindependently fixes the metadata identity boundary, as described in the maintainer comment above. I rebuilt that main commit and reran the original exact-name and ASCII-variant matrices through the public CLI on macOS arm64 / Node 24.18.0 / SQLite 3.53.1: 14 calls passed the expected controls. Automatic selection refuses malformed metadata; explicit valid subsets select the correct second column; valid rows and expanded-schema refusal remain intact. All eight fixture file hashes stayed unchanged and readonly SELECT * still returned both distinct values.The prepared fork branch is now retained read-only. No upstream PR was created from it, and this is not a claim that my patch was merged or that the previous full local/MCP suite ran on the new main. No further duplicate PR is planned for this root cause.
@morluto commented on GitHub (Oct 17, 2026):
Published
748ac7f0don main.Root cause / structural fix: column metadata crossed the binding as lossy display strings, which were reused as SQL identifiers. Read raw metadata bytes through
temp.pragma_table_xinfo(?, 'main')on the private connection with an empty temp schema, then decode strictly at that owner. Stored main tables/views cannot shadow the selected built-in. Inventory-only explicit subsets first compare encoded name bytes, so an unrelated malformed identifier cannot alias a valid requested column. Automatic selection refuses malformed names; valid U+FFFD, caller order/repeats, compact inventory omission and expanded-scope guards are preserved. Retained columns sort by native cid without copying large metadata into SQLite sorter records.Executed validation: 5 new identity controls covering UTF-8/UTF-16LE/UTF-16BE and malformed-name collision/subset outcomes; 15 selected producer/provider controls across 3 files (33 skipped, including large/stress cases); repeated focused built identity controls; check:fast; docs:check (5 checks); commit/push hooks. Public CLI baseline returned the duplicated second value; fixed automatic selection returned invalid_request with issues[0].reason=invalid_format and the malformed column-name detail. Public CLI explicit valid subset returned its correct value with columns_completeness=not_requested. SHA-256 of the malformed selected source remained identical to the baseline Evidence digest.
Context7/DeepWiki queried and checked against the actual pinned runtime. SQLite PRAGMA documentation supports raw-byte projection through table-valued PRAGMAs with the schema passed last. DeepWiki incorrectly claimed a stored main table shadows the temp-qualified built-in; a 9-case in-memory probe demonstrated the opposite for stored main tables and views. Existing production-boundary shadowing controls passed. This relies on the owned connection keeping temp empty, not on trusting stored schema names.
Costs: two equivalent completed snapshot tasks (inventory/all columns and inventory/reordered repeated subset); all 6 complete JSON replies byte-identical, 976 raw cl100k tokens each. Baseline
c7e9e096d.Two alternating warm repeats, no true cold-cache or performance claim. wait4 CPU and sampled PPID-family RSS can miss transients. Whole-agent, full CLI/MCP schema/retry, private snapshot acquisition/worker, large-file and Windows costs unmeasured. No heavy memory stress/profiling run.
Scope: generated inert offline SQLite files on macOS arm64 / Node24.18.0; actual built-in SQLite, no live application, Windows or all-engine-version qualification. Rebased over independent Cutter/JavaScript changes; affected source/test SHA-256 unchanged. Owned comparison worktree verified inactive/clean and removed normally.
@XinwangTao commented on GitHub (Oct 17, 2026):
Solid root-cause analysis — reusing lossy display strings as SQL identifiers is exactly the kind of bug that hides until two byte sequences decode to the same name. Reading raw metadata bytes through
temp.pragma_table_xinfoon the private connection and decoding strictly at the owner is the right boundary fix, and keeping explicit subsets compared by encoded bytes closes the alias hole. One UX suggestion: when automatic selection refuses a malformed column name or an ambiguity is detected, include the offending raw bytes (e.g.FF 6F 6C) in the diagnostic message — that makes it actionable for users inspecting the schema, rather than just seeing a rejection.@morluto commented on GitHub (Oct 17, 2026):
Fixed on main by
748ac7f0df(column identity is preserved before selection).Rechecked at
969aafcf2: all five SQLite column-identity regressions pass. A fresh authored SQLite fixture through the built public CLI preserves both valid columns, rejects malformed automatic selection with invalid_request / invalid_format, and returns the correct value for an explicitly selected valid column. This verifies current source/build, not the published npm package.@XinwangTao commented on GitHub (Oct 18, 2026):
Closed loop looks good — encoded-name comparison for explicit subsets plus refusal of malformed names in automatic selection covers both sides of the collision. One follow-up on the UX point: does the current rejection message include the offending raw bytes (like FF 6F 6C) in the diagnostic? Schema inspection tools usually display decoded names, so surfacing the raw bytes would make the refusal actionable without digging into the schema by hand.