Skip to content

refactor(session): drop unused RUNTIME_SESSION_ID_META_KEYS alias - #509

Draft
KrasimirKralev wants to merge 1 commit into
openclaw:mainfrom
KrasimirKralev:refactor/scout-r-2026-08-19
Draft

refactor(session): drop unused RUNTIME_SESSION_ID_META_KEYS alias#509
KrasimirKralev wants to merge 1 commit into
openclaw:mainfrom
KrasimirKralev:refactor/scout-r-2026-08-19

Conversation

@KrasimirKralev

Copy link
Copy Markdown
Contributor

What Problem This Solves

src/session/runtime-session-id.ts exported RUNTIME_SESSION_ID_META_KEYS, a bare re-alias of AGENT_SESSION_ID_META_KEYS (export const RUNTIME_SESSION_ID_META_KEYS = AGENT_SESSION_ID_META_KEYS;). Nothing referenced it — a repo-wide search (src, test, conformance, docs, scripts) finds the symbol only at its own definition, and it is not part of the published API surface: the package builds src/cli.ts, src/flows.ts, and src/runtime.ts, and none of those graphs re-export it (no export * barrel carries it). It is dead code that also forced runtime-session-id.ts to import AGENT_SESSION_ID_META_KEYS solely to alias it.

Why This Change Was Made

Debt cleanup (family: dead-code removal). Remove the unused exported alias and its now-unnecessary import binding. The live sibling helpers in the same file — normalizeRuntimeSessionId / extractRuntimeSessionId (the "runtime" wrappers actually consumed across src/acp/client.ts, src/cli/output/render.ts, src/session/persistence/*, etc.) — are untouched, as is the AGENT_SESSION_ID_META_KEYS export in src/acp/agent-session-id.js (still used internally at agent-session-id.ts:25 and asserted by test/agent-session-id.test.ts). Behavior-preserving, single production file, net −6 lines.

User Impact

None. No runtime, CLI, config, or public-API behavior changes — the removed symbol was reachable from nothing (unexported from the public entry graphs, referenced nowhere). The .d.ts output is unaffected because the alias was never in the cli/flows/runtime entry surface.

Evidence

Branched off current main (2d735cf), Linux, Node 22, pnpm install --frozen-lockfile.

  • Dead-symbol proofgit grep RUNTIME_SESSION_ID_META_KEYS returns only src/session/runtime-session-id.ts:7 (the definition) before the change, and 0 hits after.
  • No dangling referencepnpm run typecheck (tsc --noEmit) → exit 0.
  • pnpm run lint (oxlint --type-aware --deny-warnings src …) → exit 0 (confirms the import cleanup leaves no unused binding).
  • oxfmt --check src/session/runtime-session-id.ts → clean.
  • pnpm run build (tsdown, --dts) → exit 0.
  • Full test suite (pnpm run build && build:test && node --test dist-test/test/*.test.js) → 935 pass, 0 fail on this branch. The removed symbol had no test, so the count matches main; behavior is preserved and test/agent-session-id.test.ts (which asserts on AGENT_SESSION_ID_META_KEYS) still passes.

Diff: +1 / −7, 1 file. Same shape as the merged dead-export cleanup #457.

AI-assisted contribution.


Generated by Claude Code

The exported const RUNTIME_SESSION_ID_META_KEYS was a bare re-alias of
AGENT_SESSION_ID_META_KEYS with no references anywhere in the repo
(src, test, conformance, docs, scripts) and was not re-exported by any
public entry (cli/flows/runtime). Remove it and its now-unused import
binding; the live wrappers normalizeRuntimeSessionId/extractRuntimeSessionId
and the AGENT_SESSION_ID_META_KEYS export (used by its own module + test)
are untouched. Behavior-preserving.
@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 8:22 AM ET / 12:22 UTC.

ClawSweeper review

What this changes

The PR removes the unused internal session-metadata alias and its now-unneeded import while retaining the runtime session-ID wrapper functions.

Merge readiness

Ready for maintainer review

Keep open: current main still defines the alias, so this exact cleanup remains unmerged; the focused patch has no correctness finding and is ready for ordinary maintainer review once taken out of draft.

Priority: P3
Reviewed head: ee806921f035dccc950e711ede215ab51eb8e80b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) This is a focused, source-supported cleanup with proportionate terminal proof and no actionable correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body supplies after-fix terminal evidence for the dead-symbol search, typecheck, lint, build, and full test run; provided CI context also shows the checks succeeding at the head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body supplies after-fix terminal evidence for the dead-symbol search, typecheck, lint, build, and full test run; provided CI context also shows the checks succeeding at the head.
Evidence reviewed 6 items Current-main behavior: Current main still contains the alias at the reported location, so the PR's central cleanup has not already landed.
Focused PR patch: Against the PR base, the branch changes one production file: it removes the alias and unused import while retaining both forwarding functions.
Entry-point boundary: The package builds only CLI, flows, and runtime entries; inspection found no entry-point re-export of this internal module.
Findings None None.
Security None None.

Live Verification

Command: pnpm run dev -- --help

Result: PASS (completed)

pnpm run dev -- --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-509-3MlneT/target$ pnpm run dev -- --help

› acpx@0.13.1 dev /tmp/clawsweeper-live-proof-509-3MlneT/target
› tsx src/cli.ts -- --help

Usage: acpx [options] [command] [prompt...]

Headless CLI client for the Agent Client Protocol

Arguments:
  prompt                                  Prompt text

Options:
  -V, --version                           output the version number
  --agent ‹command›                       Raw ACP agent command (escape hatch)
  --cwd ‹dir›                             Working directory (default: "/tmp/clawsweeper-live-proof-509-3MlneT/target")
  --auth-policy ‹policy›                  Authentication policy: skip or fail when auth is required
  --approve-all                           Auto-approve all permission requests
  --approve-reads                         Auto-approve read/search requests and prompt for writes
  --deny-all                              Deny all permission requests
  --non-interactive-permissions ‹policy›  When prompting is unavailable: deny or fail
  --permission-policy ‹json-or-file›      Permission policy JSON or path (autoApprove, autoDeny, escalate, defaultAction)
  --policy ‹json-or-file›                 Alias for --permission-policy
  --format ‹fmt›                          Output format: text, json, quiet
  --suppress-reads                        Suppress raw read-file contents in output
  --model ‹id›                            Agent model id
  --allowed-tools ‹list›                  Allowed tool names as a comma-separated list (use "" for no tools)
  --max-turns ‹count›                     Maximum turns for the session
  --system-prompt ‹text›                  Replace the agent system prompt (claude-agent-acp via ACP _meta.systemPrompt)
  --append-system-prompt ‹text›           Append text to the agent system prompt (claude-agent-acp via ACP _meta.systemPrompt.append)
  --prompt-retries ‹count›                Retry failed prompt turns on transient errors (default: 0)
  --json-strict                           Strict JSON mode: requires --format json and suppresses non-JSON stderr output
  --no-fs                                 Do not advertise ACP filesystem capabilities
  --no-terminal                           Do not advertise ACP terminal capability
  --timeout ‹seconds›                     Maximum time to wait for agent response
  --ttl ‹seconds›                         Queue owner idle TTL before shutdown (0 = keep alive forever) (default: 300)
  --mcp-config ‹path›                     Load MCP servers from a JSON config file instead of project/global mcpServers
  --verbose                               Enable verbose debug logs
  -h, --help                              display help for command

Commands:
  pi [options] [prompt...]                Use pi agent
  openclaw [options] [prompt...]          Use openclaw agent
  codex [options] [prompt...]             Use codex agent
  claude [options] [prompt...]            Use claude agent
  gemini [options] [prompt...]            Use gemini agent
  cursor [options] [prompt...]            Use cursor agent
  copilot [options] [prompt...]           Use copilot agent
  droid [options] [prompt...]             Use droid agent
  fast-agent [options] [prompt...]        Use fast-agent agent
  grok-build [options] [prompt...]        Use grok-build agent
  iflow [options] [prompt...]             Use iflow agent
  kilocode [options] [prompt...]          Use kilocode agent
  kimi [options] [prompt...]              Use kimi agent
  kiro [options] [prompt...]              Use kiro agent
  mux [options] [prompt...]               Use mux agent
  opencode [options] [prompt...]          Use opencode agent
  pool [options] [prompt...]              Use pool agent
  qoder [options] [prompt...]             Use qoder agent
  qwen [options] [prompt...]              Use qwen agent
  trae [options] [prompt...]              Use trae agent
  zeroclaw [options]
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Session-ID helpers normalize and extract ACP agent session identifiers for the ACP client, CLI output, session management, runtime lifecycle, and persistence. The changed wrapper forwards to the canonical ACP helper and has no public entry-point export.

flowchart LR
  A[ACP response metadata] --> B[Canonical session-ID helper]
  B --> C[Runtime session wrapper]
  C --> D[ACP client]
  C --> E[CLI and runtime lifecycle]
  C --> F[Session persistence]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 1 production file; +1, -7 lines The branch is confined to removing one alias and its import binding, with no surrounding behavior change.

Technical review

Best possible solution:

Land the one-file removal after the PR is marked ready, preserving the canonical ACP key export and the two live runtime wrapper functions.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR removes an unreferenced internal alias rather than repairing a runtime symptom.

Is this the best way to solve the issue?

Yes. Removing the isolated alias is the narrowest maintainable cleanup because the canonical ACP key export and both live wrapper functions remain intact.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d4c16ab32154.

Labels

Label justifications:

  • P3: This is a small internal dead-code cleanup with no user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body supplies after-fix terminal evidence for the dead-symbol search, typecheck, lint, build, and full test run; provided CI context also shows the checks succeeding at the head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix terminal evidence for the dead-symbol search, typecheck, lint, build, and full test run; provided CI context also shows the checks succeeding at the head.

Evidence

What I checked:

  • Current-main behavior: Current main still contains the alias at the reported location, so the PR's central cleanup has not already landed. (src/session/runtime-session-id.ts:7, d4c16ab32154)
  • Focused PR patch: Against the PR base, the branch changes one production file: it removes the alias and unused import while retaining both forwarding functions. (src/session/runtime-session-id.ts:1, ee806921f035)
  • Entry-point boundary: The package builds only CLI, flows, and runtime entries; inspection found no entry-point re-export of this internal module. (package.json, d4c16ab32154)
  • Canonical behavior remains covered: The canonical key list and extractor remain exported from the ACP helper and are covered by the session-ID tests; the patch does not alter either. (test/agent-session-id.test.ts:4, ee806921f035)
  • Feature provenance: Blame attributes the current alias lines to the v0.13.1 preparation commit, identifying the current-main area owner; the latest release baseline also retains the alias. (src/session/runtime-session-id.ts:7, 2d735cf18220)
  • Structured-review limitation: The repository-local autoreview helper could not construct its required three-dot diff because this checkout lacks a local merge base for the supplied current-main SHA and PR head; direct patch, source, history, and provided CI evidence were reviewed instead.

Likely related people:

  • Peter Steinberger: Current-main blame assigns the alias and its import block to the v0.13.1 preparation commit, and history shows repeated ownership of this session-helper path. (role: current alias introducer and recent session-area contributor; confidence: high; commits: 2d735cf18220, bce1c96d9d1a; files: src/session/runtime-session-id.ts, src/acp/agent-session-id.ts)
  • Onur Solmaz: Feature history for the canonical ACP session-ID helper includes the runtime embedding API refactor that established this surrounding area. (role: earlier runtime-session contributor; confidence: medium; commits: be510ba918d4; files: src/acp/agent-session-id.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-19T11:43:24.667Z sha ee80692 :: needs maintainer review before merge. :: none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant