Skip to content

Fix hardcoded home directory fallback in container runner#7

Merged
gavrielc merged 1 commit intomainfrom
claude/fix-home-directory-fallback-FF5Tr
Feb 1, 2026
Merged

Fix hardcoded home directory fallback in container runner#7
gavrielc merged 1 commit intomainfrom
claude/fix-home-directory-fallback-FF5Tr

Conversation

@gavrielc
Copy link
Copy Markdown
Collaborator

@gavrielc gavrielc commented Feb 1, 2026

Replace environment-specific fallback '/Users/gavriel' with os.homedir()
and proper error handling. The new getHomeDir() helper function:

  • First checks process.env.HOME
  • Falls back to os.homedir() for cross-platform support
  • Throws a clear error if home directory cannot be determined

https://claude.ai/code/session_011Cs2FWxXMvAdAh4w9A6AZC

Replace environment-specific fallback '/Users/gavriel' with os.homedir()
and proper error handling. The new getHomeDir() helper function:
- First checks process.env.HOME
- Falls back to os.homedir() for cross-platform support
- Throws a clear error if home directory cannot be determined

https://claude.ai/code/session_011Cs2FWxXMvAdAh4w9A6AZC
@gavrielc gavrielc merged commit 069bc76 into main Feb 1, 2026
@gavrielc gavrielc deleted the claude/fix-home-directory-fallback-FF5Tr branch February 1, 2026 18:40
deverman pushed a commit to deverman/nanoclawswift that referenced this pull request Feb 2, 2026
…-fallback-FF5Tr

Fix hardcoded home directory fallback in container runner
Rlin1027 referenced this pull request in Rlin1027/NanoGemClaw Feb 6, 2026
New Module: health-check.ts
- /health: Returns system health status (uptime, memory, groups)
- /ready: Returns readiness for traffic
- /metrics: Prometheus-compatible metrics format

Config (config.ts):
- HEALTH_CHECK.ENABLED: Toggle via HEALTH_CHECK_ENABLED env
- HEALTH_CHECK.PORT: Default 8080

Integration (index.ts):
- Started in main() after database init
- Stopped gracefully on SIGINT/SIGTERM
- Added SIGTERM handler for container orchestration

This enables monitoring via external systems like
Kubernetes, Docker healthchecks, or Prometheus.
@cjkrueger
Copy link
Copy Markdown

Fixed: removed the result-as-message path in processMessage(). Agent now communicates only via send_message IPC tool. The isNoResponse() band-aid filter has been deleted entirely.

gavrielc added a commit that referenced this pull request Feb 17, 2026
…ting

Code fix:
- migrate.ts: migrateExisting() now calls recordCustomModification()
  to register the migration patch in state.yaml (was writing patch to
  disk but never recording it in state tracking). Also switched from
  shell-interpolated diff to execFileSync for path safety.

Doc updates to resolve 11 inconsistencies between architecture docs
and v0.1 implementation:
- #7: Base is now documented as updating after every skill apply
  (accumulated-state model), not only during core updates
- #1: State example uses name: (matching AppliedSkill type), not skill:
- #2: file_hashes documented as flat single-hash, with three-part
  (base/skill/merged) noted as future
- #3-5: Missing fields (installed_at, path_remap, author, license,
  tested_with, post_apply, etc.) documented as planned for future
- #9: Manifest example updated to use core_version: 0.1.0
- #11: Execution order updated to match actual implementation
  (backup, lock, base update, test rollback steps)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tunmaker pushed a commit to tunmaker/nanoclaw that referenced this pull request Feb 24, 2026
…-fallback-FF5Tr

Fix hardcoded home directory fallback in container runner
asantopietro added a commit to asantopietro/nanoclaw that referenced this pull request Mar 1, 2026
Closes qwibitai#6, relates to qwibitai#4

## Changes

### `container/build.sh`
- Default (no args) builds with `git rev-parse --short HEAD` SHA tag **and** re-tags as `latest`
- Optional `REGISTRY` env var: push both SHA tag and `latest` to a registry after build
- Explicit tag argument still works for one-off builds; skips `latest` re-tag in that case
- Build output now prints both tags and includes rollback instructions

### `setup/container.ts`
- Derives SHA tag via `git rev-parse --short HEAD` at build time (falls back to `'unknown'` in non-git environments)
- Builds with SHA tag, then re-tags as `latest`
- Adds `SHA_TAG` field to all `emitStatus` calls — setup output now records which exact commit was built
- Test run uses the SHA-tagged image

## Verification

After merge, `./container/build.sh` will produce:
```
nanoclaw-agent:<sha>   ← immutable, traceable
nanoclaw-agent:latest  ← always current
```

To confirm a running container's commit:
```bash
docker inspect nanoclaw-agent:latest --format '{{.Config.Labels}}'
# or compare the SHA tag against git log
```

To roll back:
```bash
docker tag nanoclaw-agent:<previous-sha> nanoclaw-agent:latest
```

Co-authored-by: Tony Santopietro <asantopietro@gmail.com>
Reviewed-on: https://gitea.cluster.lab1.lan/asantopietro/nanoclaw/pulls/7
Co-authored-by: nanoclaw-bot <nanoclaw@nowhere.net>
Co-committed-by: nanoclaw-bot <nanoclaw@nowhere.net>
nempyxaa added a commit to nempyxaa/nanoclaw that referenced this pull request Mar 4, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gabi-simons added a commit to gabi-simons/nanoclaw that referenced this pull request Mar 10, 2026
Replace Telegram/WhatsApp HttpsProxyAgent code patches with Docker
Sandbox plugin system (docker-plugin/network.json bypassDomains).
Keeps NanoClaw codebase clean — networking handled at sandbox layer.

- Add docker-plugin/ with manifest.json and network.json
- Remove patches qwibitai#7 and qwibitai#8 from sandbox-patch.sh
- Update setup-sandbox.sh to pass --plugin flag
- Include plugin files in Docker image

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5queezer added a commit to 5queezer/nanoclaw that referenced this pull request Mar 14, 2026
- Prevent API key leak in reranking fallback error log (high qwibitai#7)
- MCP tools expose actual categories instead of silently-mapped aliases (medium qwibitai#9)
- Chunker validates overlapSize < maxChunkSize to guarantee progress (medium qwibitai#13)
- Add rerankProvider to DEFAULT_RETRIEVAL_CONFIG (low)
- Remove dead findLastIndexWithin from chunker (low)
- Deduplicate loadLanceDB() call in doInitialize (low)
- Extract BM25 sigmoid divisor to documented constant (low)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
akasha-scheuermann pushed a commit to rscheuermann/nanoclaw that referenced this pull request Mar 14, 2026
…-fallback-FF5Tr

Fix hardcoded home directory fallback in container runner
bebekim pushed a commit to bebekim/goodclaw that referenced this pull request Mar 14, 2026
…-fallback-FF5Tr

Fix hardcoded home directory fallback in container runner
thegreatestcompany added a commit to thegreatestcompany/otto that referenced this pull request Mar 28, 2026
Document the stale session loop bug and the graceful fallback fix:
detect 'No conversation found' error from SDK, retry with fresh session
instead of crashing in a loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
luisherranz pushed a commit to luisherranz/nanoclaw that referenced this pull request Mar 31, 2026
Critical bugs:
- Bug qwibitai#4: Remove sequence from content hash to prevent duplicates on
  repeated PreCompact calls. Hash is now sha256(session_id:role:content).
- Bug qwibitai#5: storeMessages() now returns count of newly inserted messages.
  PreCompact only creates leaf summaries for newly inserted messages,
  preventing re-summarization of already-stored content.

Should-fix:
- #1/qwibitai#10: Add dbInitialized flag to skip redundant schema setup on
  repeated initLcmDatabase() calls (fast path for MCP tool calls).
- qwibitai#6: Depth-capped condensation now attempts API summarization first,
  falls back to truncated concatenation with 10K token cap instead of
  unbounded blob.
- qwibitai#7: Skip API call entirely when neither ANTHROPIC_API_KEY nor
  ANTHROPIC_AUTH_TOKEN is set, go straight to deterministic fallback.

Nice-to-have:
- qwibitai#3: Remove duplicate LcmMessage/LcmSummary from src/types.ts.
  Single source of truth is container/agent-runner/src/lcm-store.ts.
@Nate-Vish Nate-Vish mentioned this pull request Mar 31, 2026
5 tasks
morrowgarrett added a commit to morrowgarrett/nanoclaw that referenced this pull request Apr 1, 2026
…ation

qwibitai#5 Warm container: Already supported via 30min IDLE_TIMEOUT + IPC piping.
   Docker startup is only 0.4s; Claude Code init is the real bottleneck.
   Full elimination requires embedded SDK (future).

qwibitai#6 Frozen memory snapshot + prompt caching:
- Query memU once at container start for relevant context
- Inject as immutable system prompt prefix
- Enables Anthropic's automatic prefix caching (50-75% token savings)
- Memory context frozen for session duration (no mid-turn re-queries)

qwibitai#7 Smart model routing: Skipped — Agent SDK doesn't expose model selection
   in query options. Would require SDK changes or CLI wrapper.

qwibitai#8 FTS5 session search:
- Added FTS5 virtual table on messages for full-text cross-session search
- Auto-synced via INSERT/DELETE triggers
- searchMessages() function for keyword-based message recall
- Complements memU's semantic search with fast keyword search

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
unional pushed a commit to unional/nanoclaw-docker-sandbox-windows that referenced this pull request Apr 3, 2026
Replace Telegram/WhatsApp HttpsProxyAgent code patches with Docker
Sandbox plugin system (docker-plugin/network.json bypassDomains).
Keeps NanoClaw codebase clean — networking handled at sandbox layer.

- Add docker-plugin/ with manifest.json and network.json
- Remove patches qwibitai#7 and qwibitai#8 from sandbox-patch.sh
- Update setup-sandbox.sh to pass --plugin flag
- Include plugin files in Docker image

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
luisherranz pushed a commit to luisherranz/nanoclaw that referenced this pull request Apr 10, 2026
Critical bugs:
- Bug qwibitai#4: Remove sequence from content hash to prevent duplicates on
  repeated PreCompact calls. Hash is now sha256(session_id:role:content).
- Bug qwibitai#5: storeMessages() now returns count of newly inserted messages.
  PreCompact only creates leaf summaries for newly inserted messages,
  preventing re-summarization of already-stored content.

Should-fix:
- #1/qwibitai#10: Add dbInitialized flag to skip redundant schema setup on
  repeated initLcmDatabase() calls (fast path for MCP tool calls).
- qwibitai#6: Depth-capped condensation now attempts API summarization first,
  falls back to truncated concatenation with 10K token cap instead of
  unbounded blob.
- qwibitai#7: Skip API call entirely when neither ANTHROPIC_API_KEY nor
  ANTHROPIC_AUTH_TOKEN is set, go straight to deterministic fallback.

Nice-to-have:
- qwibitai#3: Remove duplicate LcmMessage/LcmSummary from src/types.ts.
  Single source of truth is container/agent-runner/src/lcm-store.ts.
topcoder1 referenced this pull request in topcoder1/nanoclaw Apr 12, 2026
10-task implementation plan covering:
- Restart stuck container (immediate unblock)
- Pre-emptive OAuth token refresh script + TS wrapper + tests
- Wire refresh into email-trigger and scheduled-task spawn paths
- Mount hardening (only mount Gmail dirs with credentials.json)
- GMAIL-DEGRADED skill rule + Evidence discipline rule #7
- Diagnostic script + operator runbook
- Final verification including tomorrow morning briefing rubric
topcoder1 referenced this pull request in topcoder1/nanoclaw Apr 12, 2026
Two related documentation changes that turn the agent's behavior on
Gmail/superpilot drops from 'silently degrade' to 'explicitly label':

- morning-briefing SKILL.md gains a GMAIL-DEGRADED: rule that requires
  literal error reporting and per-email subject-only labeling.

- groups/main/CLAUDE.md gains rule #7 in Evidence discipline: tool
  failures must be quoted, not hidden or invented, with degraded
  outputs labeled so the user can spot them.

Pairs with the runtime token-refresh from earlier commits — refresh
prevents most failures, and these rules ensure the rare residual
failures are visible instead of hallucinated.
foxsky added a commit to foxsky/nanoclaw that referenced this pull request Apr 12, 2026
Fixes two classes of spec violations caught by the phase 3
spec-compliance review:

- R036/R049/R056/R057: in-sync rows had Docs-present broader than
  Docs-expected. Rule qwibitai#7 requires strict bitmap equality. Broadened
  Docs-expected to match actuals (these features DO have the extra
  coverage, so the initial expected mask was under-tight).

- R022/R069/R071: stale-in-prod rows with total=0 violated rule qwibitai#4's
  "total>0 AND last_30d==0" predicate. The decision table lacks an
  explicit bucket for "shipped in code, never used, undocumented."
  Reclassified to stale-in-prod with an explicit rule-gap note on
  each row — the spirit of rule qwibitai#4 is "dormant feature", and these
  qualify regardless of doc coverage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dm-j pushed a commit to dm-j/nanoclaw that referenced this pull request Apr 13, 2026
…-fallback-FF5Tr

Fix hardcoded home directory fallback in container runner
mludoml added a commit to mludoml/nanoclaw that referenced this pull request Apr 16, 2026
…ons, DB schema changes

- registered_groups: PK is now (jid, session_group), not global
- sessions: PK is (group_folder, session_group), adds last_node tracking
- messages: bot responses now stored (is_bot_message=1)
- New env vars: SESSION_GROUP, CLAUDE_MODEL documented in all .env examples
- Syncthing: added nanoclaw-main-sessions and nanoclaw-trading-sessions folders
- Dev workflow: updated copy command to include db.ts, index.ts, task-scheduler.ts
- New customizations: qwibitai#6 SESSION_GROUP isolation, qwibitai#7 CLAUDE_MODEL

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
topcoder1 referenced this pull request in topcoder1/nanoclaw Apr 16, 2026
Extend SmokeTestDeps with triggerDebouncer field, add check #7 in
handleSmokeTest that reports buffer size or 'not initialized', and wire
getEmailTriggerDebouncer() into the handleSmokeTest call in index.ts.
Update all test deps objects to include the new field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
topcoder1 referenced this pull request in topcoder1/nanoclaw Apr 16, 2026
Extend SmokeTestDeps with triggerDebouncer field, add check #7 in
handleSmokeTest that reports buffer size or 'not initialized', and wire
getEmailTriggerDebouncer() into the handleSmokeTest call in index.ts.
Update all test deps objects to include the new field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gavrielc added a commit that referenced this pull request Apr 18, 2026
Moves user-roles / users / agent-group-members / user-dms /
dropped-messages / user-dm / canAccessAgentGroup into
src/modules/permissions/. Module registers a single inbound-gate that
owns sender resolution, access decision, unknown-sender policy, and
drop-audit recording.

Router slimmed from 357 → 179 lines; the inline fallback chain
(extractAndUpsertUser / enforceAccess / handleUnknownSender /
recordDroppedMessage) is gone — without the permissions module core
defaults to allow-all with userId=null.

container-runner's admin-ID query is now inline SQL guarded by
sqlite_master on user_roles, keeping core free of any import from the
permissions module. The container-side formatter falls back to
permissionless mode when NANOCLAW_ADMIN_USER_IDS is empty: every sender
with an identifiable senderId is treated as admin.

Module contract doc formalizes the tier model and the dependency rule
(core ← default modules ← optional modules). One transitional violation
flagged: src/access.ts (core) imports from the permissions module for
its remaining approver-picking helpers; resolves in the planned PR #7
re-tier.

Validation: host build clean, 137/137 host tests, 17/17 container
tests, typecheck clean, service boots to "NanoClaw running" with
permissions module registering its gate and clean SIGTERM shutdown.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants