Repository navigation
Description
Agent Brief
Type: Task
Summary: Move the sql_path helper, the OTEL store default line and the die function that three observability scripts repeat into one sourced file, plugins/harness-ops/skills/observability/otel/otel-sql.sh (part of restructuring pass #14622).
Current behavior:
Three scripts under plugins/harness-ops/skills/observability/scripts/ define the same 5-line sql_path, which turns an MSYS path into a Windows one for native duckdb and doubles single quotes for a SQL literal:
hook-latency.sh:111-115item-rollup.sh:71-75session-compare.sh:46-50
All three set store with the same one-line default (CC_OTEL_STORE, else a directory under the repository root or the working directory): hook-latency.sh:118, item-rollup.sh:77 and session-compare.sh:52. Each already sets OTEL_DIR="$SCRIPT_DIR/../otel" (hook-latency.sh:29, item-rollup.sh:22, session-compare.sh:21).
All three also define the same 4-line die, which prints <script-name>: <message> to stderr and exits 2, differing only in the printed script name: hook-latency.sh:32-35, item-rollup.sh:25-28, session-compare.sh:24-27. Each defines it after its OTEL_DIR line and before any call.
Desired behavior:
- New
otel/otel-sql.sh, mode 100644, sourced only, headed# shellcheck shell=bashand a "Sourced (not executed) by hook-latency.sh, item-rollup.sh and session-compare.sh" comment, asplugins/harness-ops/skills/plugins/scripts/jq-capture.sh:1-6is. - It holds
sql_path, verbatim, andotel_store_to <var>, which assigns the store default line's value into the named variable, in the<name>_to <var>form ofjq-capture.sh:8-12. Astore="$(...)"form would strip a trailing newline fromCC_OTEL_STORE, which the inline line keeps. - It also holds
die, which runsprintf '%s: %s\n' "$OTEL_PROG" "$1" >&2and exits 2, so the script name is a parameter rather than a literal and each message stays byte-identical. - Each script sets
OTEL_PROGto its own name (hook-latency,item-rollup,session-compare) and sources the file after itsOTEL_DIRline with a# shellcheck source=../otel/otel-sql.shline andsource "$OTEL_DIR/otel-sql.sh", both before the firstdiecall. It deletes its ownsql_pathanddie, and replaces its store line withotel_store_to storeat the same place, so the order of the duckdb and store checks is unchanged. - Each script keeps its own
usage, which readsBASH_SOURCE[0]and its own line range (hook-latency.sh:31,item-rollup.sh:24,session-compare.sh:23), its own store and duckdb checks (hook-latency.sh:117,119,item-rollup.sh:78-81,session-compare.sh:53-56) and its own success test (hook-latency.sh:126,item-rollup.sh:95,session-compare.sh:72). - No
otel-sql.test.shis added: the test selector maps the new file through each script whosesourceline names it (scripts/affected-tests.sh:93-97), the three suites run the scripts in place (hook-latency.test.sh:9,item-rollup.test.sh:9,session-compare.test.sh:9), andotel/prune-compact.shandotel/prune-collector-lifecycle.shbeside it have no suite of their own (git ls-files).
Files:
plugins/harness-ops/skills/observability/otel/otel-sql.sh(new)plugins/harness-ops/skills/observability/scripts/hook-latency.shplugins/harness-ops/skills/observability/scripts/item-rollup.shplugins/harness-ops/skills/observability/scripts/session-compare.sh- a new
patchfragment in.changes/harness-ops/:### Changed, "Internal restructuring, no behavior change."
Key interfaces:
- Each script's arguments, output, exit codes and error text: unchanged; every
diemessage keeps its script-name prefix byte for byte. otel/prune-compact.sh:86-94keeps its ownsql_path, which adds anOS_KINDgate;otel/cc-otel.test.sh:28-30keeps its test-local one;hook-transcript-timing.shkeeps its ownusageanddie(:28-32) and is not touched: it sets noOTEL_DIRand reads transcripts, not the store.- No test or eval names
sql_path,otel_store_toorOTEL_PROGin the three suites, and no other file carries a copy of the three scripts (scripts/shared-copies.txt,scripts/cross-plugin-source-registry.txt: 0 hits).
Acceptance criteria:
-
sql_path, the store default line anddieexist once, inotel/otel-sql.sh, and the three scripts source it. - Behavior is unchanged: the same outputs, exit codes and printed results for the same inputs.
- The diff edits only the listed files and the lines of a test that assert on them when the change breaks that assertion.
- The pull request stays within 400 changed lines and 15 hand-edited files.
-
hook-latency.test.sh,item-rollup.test.shandsession-compare.test.shinplugins/harness-ops/skills/observability/scripts/pass. - ci-status is green.
Out of scope:
- Each script's
usage, store and duckdb checks and success test,prune-compact.sh,hook-transcript-timing.sh, a new test file, other duplication, eval cases, fixtures, and skill and agent text.
Metadata
Metadata
Assignees
Labels
Type
Fields
Work status
Priority
Activity
melodic-automation-lanes commentedon Nov 12, 2026
{"v":1,"actor_id":337595936,"title_sha256":"40e83316f9bc98a15ae24ff7235ddd2ba1f8059a9dbaeb58fba345903565f49e","body_sha256":"ef8eb502effa7d08d83a310e5a8d437491197ab08bf534b8ade34dde92457d77"}
github-actions commentedon Nov 12, 2026